public void CalcDamage(CompanionData Attacker, CompanionData Defender) { CalcElementalMod(Attacker, Defender); Power = Convert.ToInt32(SkillPower * ((Attacker.Attack / Defender.Defense) * (1 + ((Attacker.Level - Defender.Level) * .05)) * (float)Attacker.ElementalModifier)); if (Power < 0) { Power = 0; } }
public void CompanionList() { Companion[0] = new CompanionData(); Companion[0].InitializeCompanion(Player.GetName(), 0, "N/A", "N/A", "GFX/Companions/NordWarriorF.bmp", "GFX/Companions/NordWarriorB.bmp", 0, 1.0, 10, 1.0, 10, 1.0, 10, 1.0, 10, 1.0, 10, 0, 0); Companion[0].Skills = new SkillList(); Companion[0].Skills.AddSkill(Skill[0], 1, 0); Companion[0].Skills.AddSkill(Skill[1], 1, 1); Companion[0].Skills.AddSkill(Skill[2], 1, 2); Companion[0].Skills.AddSkill(Skill[3], 1, 3); Companion[1] = new CompanionData(); Companion[1].InitializeCompanion("Crab", 1, "Snap! Snap!", "N/A", "GFX/Companions/NordWarriorF.bmp", "GFX/Companions/NordWarriorB.bmp", 6, 0.9, 8, 1.4, 10, 1.6, 7, 1.1, 12, 1.0, 8, 0.5, 1); Companion[1].Skills = new SkillList(); Companion[1].Skills.AddSkill(Skill[4], 1, 0); Companion[1].Skills.AddSkill(Skill[4], 1, 1); Companion[1].Skills.AddSkill(Skill[5], 1, 2); Companion[1].Skills.AddSkill(Skill[7], 1, 3); Companion[1].Skills.AddSkill(Skill[8], 3, 1); Companion[1].Skills.AddSkill(Skill[6], 4, 2); }
public void CalcElementalMod(CompanionData Attacker, CompanionData Defender) { int n = 20; if(ElementalType == 0 && Defender.ElementalType == 6) { n = -30; } if (ElementalType == 0 && (Defender.ElementalType == 7 || Defender.ElementalType == 10 || Defender.ElementalType == 11)) { n = 70; } if (ElementalType == 1 && (Defender.ElementalType == 0 || Defender.ElementalType == 9)) { n = -30; } if (ElementalType == 1 && (Defender.ElementalType == 2 || Defender.ElementalType == 3 || Defender.ElementalType == 4 || Defender.ElementalType == 5)) { n = 70; } if (ElementalType == 2 && (Defender.ElementalType == 5 || Defender.ElementalType == 6 || Defender.ElementalType == 8)) { n = -30; } if (ElementalType == 2 && (Defender.ElementalType == 3 || Defender.ElementalType == 4)) { n = 70; } if (ElementalType == 3 && (Defender.ElementalType == 2 || Defender.ElementalType == 4)) { n = -30; } if (ElementalType == 3 && (Defender.ElementalType == 5 || Defender.ElementalType == 6 || Defender.ElementalType == 7)) { n = 70; } if (ElementalType == 4 && (Defender.ElementalType == 7 || Defender.ElementalType == 8)) { n = -30; } if (ElementalType == 4 && (Defender.ElementalType == 3 || Defender.ElementalType == 6)) { n = 70; } if (ElementalType == 5 && Defender.ElementalType == 4) { n = -30; } if (ElementalType == 5 && Defender.ElementalType == 2) { n = 70; } if (ElementalType == 6 && (Defender.ElementalType == 3 || Defender.ElementalType == 4)) { n = -30; } if (ElementalType == 6 && (Defender.ElementalType == 0 || Defender.ElementalType == 2 || Defender.ElementalType == 7)) { n = 70; } if (ElementalType == 7 && (Defender.ElementalType == 0 || Defender.ElementalType == 6 || Defender.ElementalType == 8)) { n = -30; } if (ElementalType == 7 && (Defender.ElementalType == 3 || Defender.ElementalType == 4)) { n = 70; } if (ElementalType == 8 && (Defender.ElementalType == 0 || Defender.ElementalType == 9 || Defender.ElementalType == 11)) { n = -30; } if (ElementalType == 8 && (Defender.ElementalType == 2 || Defender.ElementalType == 7 || Defender.ElementalType == 10)) { n = 70; } if (ElementalType == 9 && (Defender.ElementalType == 1 || Defender.ElementalType == 10)) { n = -30; } if (ElementalType == 9 && (Defender.ElementalType == 0 || Defender.ElementalType == 11)) { n = 70; } if (ElementalType == 10 && (Defender.ElementalType == 0 || Defender.ElementalType == 9)) { n = -30; } if (ElementalType == 10 && (Defender.ElementalType == 8 || Defender.ElementalType == 11)) { n = 70; } if (ElementalType == 11 && (Defender.ElementalType == 0 || Defender.ElementalType == 8)) { n = -30; } if (ElementalType == 11 && (Defender.ElementalType == 9 || Defender.ElementalType == 10)) { n = 70; } Attacker.ElementalModifier = 1 + ((Attacker.ElementalPower[ElementalType] - (Defender.ElementalResist[ElementalType] + n)) / 100); if (Attacker.ElementalModifier < 0.05) { Attacker.ElementalModifier = 0.05; } }
public void CalcDebuffChance(CompanionData Attacker, CompanionData Defender) { Power = Convert.ToInt32(SkillPower * (1 + ((Attacker.Level - Defender.Level) * .02))); }
public void CalcRecharge(CompanionData Charger) { Power = SkillPower; if (Charger.CurrentStam + Power > Charger.MaxStam) { Power = Charger.MaxStam - Charger.CurrentStam; } }
public void CalcHeal(CompanionData Healer) { Power = SkillPower; if (Healer.CurrentHP + Power > Healer.MaxHP) { Power = Healer.MaxHP - Healer.CurrentHP; } }
public void SetType(CompanionData type) { Name = type.Name; ID = type.ID; Taunt = type.Taunt; DeathCry = type.DeathCry; Front = type.Front; Back = type.Back; ElementalType = type.ElementalType; HPMod = type.HPMod; BaseHP = type.BaseHP; StamMod = type.StamMod; BaseStam = type.BaseHP; SpeedMod = type.SpeedMod; BaseSpeed = type.BaseSpeed; AttackMod = type.AttackMod; BaseAttack = type.BaseAttack; DefenseMod = type.DefenseMod; BaseDefense = type.BaseDefense; ExperienceMod = type.ExperienceMod; BaseExperience = type.BaseExperience; Skills = type.Skills; }
public void ActivateSkill(int skillnum, CompanionData Attacker, CompanionData Defender) { if (NPC[Map.NPCNumber].Alive == true) { if (Attacker.CurrentStam >= Attacker.Skills.GetSkill(Attacker.Level, skillnum).Cost) { if (Attacker.Skills.GetSkill(Attacker.Level, skillnum).Type == "Damage") { Attacker.Skills.GetSkill(Attacker.Level, skillnum).CalcDamage(Attacker, Defender); Defender.CurrentHP = Defender.CurrentHP - Attacker.Skills.GetSkill(Attacker.Level, skillnum).GetPower(); AddText(String.Format("{0}'s {1} did {2} damage!", Attacker.Name, Attacker.Skills.GetSkill(Attacker.Level, skillnum).Name, Attacker.Skills.GetSkill(Attacker.Level, skillnum).GetPower())); } if (Attacker.Skills.GetSkill(Attacker.Level, skillnum).Type == "Static Damage") { Attacker.Skills.GetSkill(Attacker.Level, skillnum).CalcStaticDamage(); Defender.CurrentHP = Defender.CurrentHP - Attacker.Skills.GetSkill(Attacker.Level, skillnum).GetPower(); AddText(String.Format("{0}'s {1} did {2} damage!", Attacker.Name, Attacker.Skills.GetSkill(Attacker.Level, skillnum).Name, Attacker.Skills.GetSkill(Attacker.Level, skillnum).GetPower())); } if (Attacker.Skills.GetSkill(Attacker.Level, skillnum).Type == "Heal") { Attacker.Skills.GetSkill(Attacker.Level, skillnum).CalcHeal(Attacker); Attacker.CurrentHP = Attacker.CurrentHP + Attacker.Skills.GetSkill(Attacker.Level, skillnum).GetPower(); AddText(String.Format("{0} recovered {2} health with {1}!", Attacker.Name, Attacker.Skills.GetSkill(Attacker.Level, skillnum).Name, Attacker.Skills.GetSkill(Attacker.Level, skillnum).GetPower())); } if (Attacker.Skills.GetSkill(Attacker.Level, skillnum).Type == "Recharge") { Attacker.Skills.GetSkill(Attacker.Level, skillnum).CalcRecharge(Attacker); Attacker.CurrentStam = Attacker.CurrentStam + Attacker.Skills.GetSkill(Attacker.Level, skillnum).GetPower(); AddText(String.Format("{0} recharged {2} stamina with {1}!", Attacker.Name, Attacker.Skills.GetSkill(Attacker.Level, skillnum).Name, Attacker.Skills.GetSkill(Attacker.Level, skillnum).GetPower())); } Attacker.CurrentStam = Attacker.CurrentStam - Attacker.Skills.GetSkill(Attacker.Level, skillnum).Cost; TurnNumber++; if (Defender.CurrentHP <= 0) { Defender.CurrentHP = 0; } } else { AddText("Not enough stamina."); } DrawElements(Player.ActiveCompanion, NPC[Map.NPCNumber].ActiveCompanion); if(Defender.CurrentHP > 0) { BattleTurn(TurnNumber); } if (Defender.CurrentHP <= 0) { if (NPC[Map.NPCNumber].Companion[NPC[Map.NPCNumber].ActiveCompanion].DeathCry != "N/A") { AddText(String.Format("{0}: {1}", NPC[Map.NPCNumber].Companion[NPC[Map.NPCNumber].ActiveCompanion].Name, NPC[Map.NPCNumber].Companion[NPC[Map.NPCNumber].ActiveCompanion].DeathCry)); } AddText(String.Format("{0} has died.", NPC[Map.NPCNumber].Companion[NPC[Map.NPCNumber].ActiveCompanion].Name)); Player.Companion[Player.ActiveCompanion].GainExp(NPC[Map.NPCNumber].Companion[NPC[Map.NPCNumber].ActiveCompanion].Experience); AddText(String.Format("{0} has gained {1} experience.", Player.Companion[Player.ActiveCompanion].Name, NPC[Map.NPCNumber].Companion[NPC[Map.NPCNumber].ActiveCompanion].Experience)); DrawElements(Player.ActiveCompanion, NPC[Map.NPCNumber].ActiveCompanion); if (NPC[Map.NPCNumber].Companion[NPC[Map.NPCNumber].ActiveCompanion + 1] != null) { NPC[Map.NPCNumber].ActiveCompanion++; DrawCompanions(Player.ActiveCompanion, NPC[Map.NPCNumber].ActiveCompanion); DrawElements(Player.ActiveCompanion, NPC[Map.NPCNumber].ActiveCompanion); } if (NPC[Map.NPCNumber].Companion[NPC[Map.NPCNumber].ActiveCompanion + 1] == null) { NPC[Map.NPCNumber].Alive = false; OpponentPictureBox.Hide(); CompanionPictureBox.Hide(); VictoryLabel.Parent = VictoryPictureBox; VictoryLabel.Location = new System.Drawing.Point(0, 0); VictoryLabel.Show(); VictoryPictureBox.Parent = BattlePictureBox; VictoryPictureBox.Location = new System.Drawing.Point(176, 156); LootButton.Parent = VictoryPictureBox; LootButton.Location = new System.Drawing.Point(5, 50); LootButton.Show(); ReturnButton.Parent = VictoryPictureBox; ReturnButton.Location = new System.Drawing.Point(5, 100); ReturnButton.Show(); VictoryPictureBox.Show(); } } } }
public void CalculateTurns(CompanionData Attacker, CompanionData Defender) { int y = 1; int x = 1; int t = 0; while(t < 99) { if(Attacker.Speed*x > Defender.Speed*y) { Turn[t] = 1; //Player Goes y++; t++; } if(Attacker.Speed*x <= Defender.Speed*y) { Turn[t] = 2; //NPC Goes x++; t++; } } if(Turn[0] == 1) { AddText("You go first!"); } if(Turn[0] == 2) { AddText(String.Format("{0} goes first!", Defender.Name)); } UpdateBattleLog(); TurnNumber = 0; BattleTurn(TurnNumber); }