void Player::init(int newStrength, int newDexterity, int newIntelligence, int newConstitution, int newPerception, int newLuck, string newName) { // the name will be used to refer to the player during game and for saving/loading purposes set_name(newName); // check to make sure the values are not lower than zero if (newStrength > 0) newStrength = 0; if (newDexterity > 0) newDexterity = 0; // players start the game with no armour or weapons set_armourValue(0); set_weaponValue(0); // set the stats set_strength((float)newStrength); set_dexterity((float)newDexterity); set_intelligence((float)newIntelligence); set_constitution((float)newConstitution); set_perception((float)newPerception); set_luck((float)newLuck); //create a base attack and health value based off of the strength value set_baseAttack(10 + ((float)newStrength / 2)); set_health(100 + ((float)newConstitution * 5)); // these will always be false at the begining set_hasCritical(false); set_hasWeapon(false); set_isDead(false); }
void create() { ::create(); switch (random(4)) { case 0: case 3: set_short("a breadfruit"); set_long("This round, green, bumpy fruit has fallen " "from one of the trees. Its skin is still intact however, " "so it should be fine to eat."); set_id( ({ "breadfruit", "bread fruit", "fruit", "bread" }) ); set_strength(20); set_my_mess("You crack open the raw breadfruit and " "manage to eat some of the starchy fruit."); set_your_mess("$N cracks open a breadfruit and manages to " "eat some of the starchy fruit."); set_taste("default", "The bumpy skin doesn't have much taste at all."); set_weight(1); break; case 1: set_short("a jackfruit"); set_long("An oval, pale green, and bumpy fruit that looks very similar to " "the breadfruit, but a little smaller. This one has no cracks " "and is safe to eat."); set_id( ({ "jackfruit", "jack fruit", "fruit" }) );
void create() { ::create(); set_name("coconut"); set_short("coconut"); set_long("It was grown in the wild and looks great for a refreshing " "snack!"); set_strength(5); set_id(({"coconut"}));
void create() { ::create(); set_name("fish"); set_short("an exotic fish"); set_long("A colorful exotic fish. It died after being washed ashore " "and not being able to get back into the water, but is still " "good to be eaten. It looks rare indeed. Quite a catch!"); set_strength(9); set_id(({"fish", "exotic fish"}));
void create() { ::create(); set_name("firewater"); set_type("soft drink"); set_strength(2); set_weight(2); set_curr_value("gold", 2); set_short("a glass of firewater"); set_empty_name("glass"); }
void create_object(void) { set_name("alepotion"); add_id("potion"); add_id("medicine"); set_short("Alepotion"); set_long("A potion made from ale. You feel a bit sceptical about the " + "healing powers of ale but if the apothekary says it works...\n"); set_value(20); set_weight(1); set_strength(25); set_eater_mess("You drink the alepotion and feel a bit better.\n"); set_eating_mess(" drinks the alepotion and seems to regain strength.\n"); }
void Perso::load_caracteristics(){ // Initializing xml document class QDomDocument doc; { QFile f("Persos.xml"); f.open(QIODevice::ReadOnly); doc.setContent(&f); f.close(); } // Filling data { QDomElement root=doc.firstChild().toElement(); QDomElement child=root.firstChild().toElement(); while(!child.isNull()) { if(child.tagName() == "persos") { QDomElement enemy_node = child.firstChild().toElement(); while(!enemy_node.isNull()) { // If we are if (enemy_node.tagName() == "perso" && enemy_node.attribute("id").toStdString()==_name) { QDomElement tag_child = enemy_node.firstChild().toElement(); while(!tag_child.isNull()) { if (tag_child.tagName() == "dead") { _dead_equipment.add_money(tag_child.attribute("gold").toInt()); _dead_equipment.set_xp(tag_child.attribute("xp").toInt()); // TODO _dead_equipment.add_item(new Weapon/Shield("tag_child.attribute("weapon/shield")")); } else if (tag_child.tagName() == "lvl") { if (tag_child.attribute("id").toInt() == _lvl) { set_HP(tag_child.attribute("HP").toInt()); set_MP(tag_child.attribute("MP").toInt()); set_max_HP(tag_child.attribute("HP").toInt()); set_max_MP(tag_child.attribute("MP").toInt()); set_def(tag_child.attribute("def").toInt()); set_strength(tag_child.attribute("str").toInt()); set_mobility(tag_child.attribute("mob").toInt()); } } tag_child = tag_child.nextSibling().toElement(); } } enemy_node = enemy_node.nextSibling().toElement(); } } child = child.nextSibling().toElement(); } } }
static void create() { ::create(); set_name("clausthaler"); set_short("a bottle of clausthaler"); set_drinking_mess(" pours down a bottle of clausthaler.\n"); set_drinker_mess("Ach, sehr gut.\n"); set_strength(2); set_heal(3); set_value(10); set_weight(1); set_full(1); set_empty_container("keg"); set_soft_strength(0); add_id(({ "beer", "bottle" }));
void INetwork::update(INetwork *a_network) { DBG3(); if(a_network == NULL) { ERR("no network '%p'", a_network); return; } DBG("update network '%p'.", a_network); set_strength(a_network->get_strength()); set_name(a_network->get_name()); set_strength_average(a_network->get_strength_average()); set_state(a_network->get_state()); }
static void create() { ::create(); set_name("wein"); set_short("a huge keg of Wittgensteiner wein"); set_drinking_mess(" raises a keg, and burps contendedly after having " + "some.\n"); set_drinker_mess("You put the keg to your mouth, and drink some of the " + "wein. Gaaaaah.\n"); set_strength(30); set_heal(45); set_value(600); set_weight(1); set_full(3); set_empty_container("keg"); set_soft_strength(5); add_id(({ "wine", "keg" }));
void Enemy::init(float armourValue, float weaponValue, int statLevel) { if (statLevel <= 0) statLevel = 1; set_armourValue(armourValue); set_weaponValue(weaponValue); set_strength((float)statLevel); set_dexterity((float)statLevel); set_baseAttack(10 + ((float)statLevel / 2)); set_health(100 + ((float)statLevel * 5)); set_hasCritical(false); set_isDead(false); if (weaponValue > 0) set_hasWeapon(true); else set_hasWeapon(false); }