public string Use(IGameCreature target) { foreach (string type in types) { if (type.ToLower() == "projectile") { foreach (string type2 in types) { if (type2.ToLower() == "weapon") { return(target.updateHealth(-rarity)); } if (type2.ToLower() == "heal") { return(target.updateHealth(rarity)); } } } if (type.ToLower() == "trade") { foreach (string type2 in types) { if (type2.ToLower() == "trinket") { return("Traded " + name + " for " + rarity + " gold\n"); } } } } return(""); }
public string attack(IGameCreature creature) { int hitValue = StoryGenerationClass.Instance.getRandomNumber(100); if (hitValue > creature.getCreature().getValue() * 5) { // hit int hitDamage; if (weapon != null) { hitDamage = StoryGenerationClass.Instance.getRandomNumber(weapon.getRarity() + 1) + 1; } else { hitDamage = StoryGenerationClass.Instance.getRandomNumber(2) + 1; } creature.updateHealth(-hitDamage); return("You dealt " + hitDamage + " damage to " + creature.getCreature().getName() + "\n" + creature.getCreature().getName() + " has " + creature.getHealth() + " health left\n"); } else { // miss return("You attack was blocked by " + creature.getCreature().getName() + "\n"); } }
public string attack(IGameCreature creature) { int hitValue = StoryGenerationClass.Instance.getRandomNumber(100); if(hitValue > creature.getCreature().getValue() * 5) { // hit int hitDamage; if(weapon != null) { hitDamage = StoryGenerationClass.Instance.getRandomNumber(weapon.getRarity() + 1) + 1; } else hitDamage = StoryGenerationClass.Instance.getRandomNumber(2) + 1; creature.updateHealth(-hitDamage); return "You dealt " + hitDamage + " damage to " + creature.getCreature().getName() + "\n" + creature.getCreature().getName() + " has " + creature.getHealth() + " health left\n"; } else { // miss return "You attack was blocked by " + creature.getCreature().getName() + "\n"; } }
public string Use(IGameCreature target) { foreach (string type in types) { if (type.ToLower() == "projectile") { foreach (string type2 in types) { if (type2.ToLower() == "weapon") { return target.updateHealth(-rarity); } if( type2.ToLower() == "heal") { return target.updateHealth(rarity); } } } if (type.ToLower() == "trade") { foreach (string type2 in types) { if (type2.ToLower() == "trinket") { return "Traded " + name + " for " + rarity + " gold\n"; } } } } return ""; }