void startTurn() { currentCharacter = allCharacters[turnCounter]; //Combat.output(allCharacters[turnCounter].activateStatus()); if (currentCharacter.team == "player") { Combat.output("Beginning turn of " + currentCharacter.Name + "...", bold: true, textColor: System.Drawing.Color.DodgerBlue); } else { Combat.output("Beginning turn of " + currentCharacter.Name + "...", bold: true, textColor: System.Drawing.Color.Firebrick); } currentCharacter.activateStatus("turn"); currentCharacter.checkSkills(); if (currentCharacter.behavior != null) { // Console.WriteLine("We see you are an AI "+currentCharacter.Name); currentCharacter.behavior.startAITurn(this); return; } mainForm.getSkills(currentCharacter); //activating all of the status, pass what turn step it is update(); }
public void healEnergy(float dmg, bool percent) { int damage; if (percent) { damage = Convert.ToInt32(Math.Ceiling(maxMP * (dmg / 100f))); } else { damage = Convert.ToInt32(Math.Ceiling(dmg)); } MP += damage; if (MP > maxMP) { MP = maxMP; } if (damage > -1) { Combat.output(Name + " recovered " + damage.ToString() + " energy!", textColor: System.Drawing.Color.LightBlue); } else { Combat.output(Name + "lost " + (-1 * damage).ToString() + " energy!", textColor: System.Drawing.Color.Red); } }
float criticalHit(float dmg) { Combat.output("SMAAAAASH!", bold: true, underline: true, textColor: System.Drawing.Color.DarkOrange); float totalDamage = dmg * criticalDamage; //Console.WriteLine("damage increased by crit from "+dmg.ToString()+" to "+(dmg * criticalDamage).ToString()); return(totalDamage); }
public void rest() { double percent = Combat.rng.NextDouble(); //d = ((d * (3.2 - .23)) + .23); percent = ((percent * (0.60 - 0.25)) + 0.25); //this line should set a min and max for the double% MP += (int)(maxMP * percent); //user rests and gains back some of their stamina Combat.output(Name + " rests."); }
bool useStamina() { float staminaTotal = 0f; staminaTotal = user.stamina * 100f; staminaTotal = staminaTotal * (staminaUse / 100f); //turn the staminatotal into a percent of the users base stamina //drain that staminatotal from their current stamina if (user.MP >= staminaTotal) { //user.healEnergy((staminaTotal * -1), false); user.useEnergy(staminaTotal); return(true); } Combat.output(user.Name + " doesn't have enough stamina to use " + Name, underline: true, textColor: System.Drawing.Color.DimGray); return(false);//not enough mp, return false }
public void damage(float dmg, string element, bool percent) { int damage; if (percent) { damage = Convert.ToInt32(Math.Ceiling(maxHP * (dmg / 100f))); } else { damage = Convert.ToInt32(Math.Ceiling(dmg)); } HP -= damage; System.Drawing.Color textColor = getElementColor(element); Combat.output(Name + " received " + damage.ToString(), endLine: false); Combat.output(" " + element + " damage ", textColor: textColor); //Combat.output(Name+" took "+ damage.ToString() + " " + element + " damage!"); }
public void heal(float dmg, bool percent) { int damage; if (percent) { damage = Convert.ToInt32(Math.Ceiling(maxHP * (dmg / 100f))); } else { damage = Convert.ToInt32(Math.Ceiling(dmg)); } HP += damage; if (HP > maxHP) { HP = maxHP; } //make sure we don't heal them past full Combat.output(Name + " was healed for " + damage.ToString() + "!", textColor: System.Drawing.Color.Green); }
private void attack(int min, int max, string targetGroup) { switch (targetGroup) { case "enemies": for (int c = 0; c < targets.Count; c++) { currentTarget = c; int AC = accuracyCheck(); if (targets[c].team != user.team && AC > 0) { Combat.output(user.Name + " hits " + targets[c].Name + " with " + Name); float dmg = getDamage(); if (AC == 2) { dmg = criticalHit(dmg); } //critical hit targets[c].damage(dmg, element, false); } else { Combat.output(user.Name + " missed " + targets[c].Name + " with " + Name, textColor: System.Drawing.Color.BurlyWood); } } break; /* foreach (Character c in targets) * { * int AC = accuracyCheck(); * if (c.team != user.team && AC > 0) * { * Combat.output(user.Name + " hits " + c.Name + " with " + Name); * float dmg = getDamage(); * if (AC == 2) { dmg = criticalHit(dmg); } //critical hit * c.damage(dmg, element, false); * } * else { Combat.output(user.Name + " missed " + c.Name + " with " + Name, textColor: System.Drawing.Color.BurlyWood); } * }*/ case "allies": for (int c = 0; c < targets.Count; c++) { currentTarget = c; int AC = accuracyCheck(); if (targets[c].team == user.team && targets[c] != user && AC > 0) { Combat.output(user.Name + " hits " + targets[c].Name + " with " + Name); float dmg = getDamage(); if (AC == 2) { dmg = criticalHit(dmg); } //critical hit targets[c].damage(dmg, element, false); } else { Combat.output(user.Name + " missed " + targets[c].Name + " with " + Name, textColor: System.Drawing.Color.BurlyWood); } } break; case "self": for (int c = 0; c < targets.Count; c++) { currentTarget = c; int AC = accuracyCheck(); if (targets[c] == user && AC > 0) { Combat.output(user.Name + " hits themself with " + Name); float dmg = getDamage(); if (AC == 2) { dmg = criticalHit(dmg); } //critical hit targets[c].damage(dmg, element, false); } else { Combat.output(user.Name + " missed themself with " + Name, textColor: System.Drawing.Color.BurlyWood); } } break; default: Combat.output("What happened here? Attack no targets?"); break; } }