Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ - RPG

Name: Anonymous 2010-10-29 15:44

Lets program a roleplaying game together. Each post must contain either a new function or an edited version of an old function in psudocode. I will start:

int dealDamage(int hp, int damage){
    return hp - damage;
}

Name: Anonymous 2010-10-30 9:28

>>45
int hit(struct character *target, struct character *attacker, struct weapon *weapon, int die) {
   return die * attacker->accuracy * weapon->accuracy_factor > target->evasiveness;
}
enum effect attack(struct character *target, struct character *attacker) {
    struct weapon *w = attacker->current_weapon;
    if (hit(target, attacker, weapon, throw_dice(w->n_dice, w->die_sides)) {
        int damage = calculateDamage(target->armor, weapon);
        target->hp = dealDamage(target->hp, damage);
        return E_DAMAGE_INFLICTED;
    } else {
        return E_COUNTER_ATTACK;
    }
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List