Exemple #1
0
 //add attack button
 private void btnIndividualAttack_Click(object sender, EventArgs e)
 {
     if (SaveChar())
     {
         if (CombatHolder._alreadyAttackedThisRound.Contains(ThisChar))
         {
             CombatHolder._alreadyAttackedThisRound.Remove(ThisChar);
         }
         else
         {
             ThisChar.CombatStuff.readyForCombat = true;
             CombatHolder.toggleCharAttack(ThisChar);
         }
         SetColorCorrectly();
         CombatHolder._masterOfDeclarations.UpdateRTB();
     }
 }
Exemple #2
0
 private string Combat(Character selectedByUser, Dictionary <String, String> args)
 {
     if (args.ContainsKey("selectedweapon"))
     {
         selectedByUser.CombatStuff.CombatWeapon = selectedByUser.Weapons.Find(A => A.ItemName == args["selectedweapon"]);
     }
     if (args.ContainsKey("selectedshield"))
     {
         selectedByUser.CombatStuff.CombatShield = selectedByUser.Shields.Find(A => A.ItemName == args["selectedshield"]);
     }
     if (args.ContainsKey("selectedtargets"))
     {
         selectedByUser.LastAttackTargetSelected = args["selectedtargets"];
         if (args.ContainsKey("action"))
         {
             if (!CombatHolder._alreadyAttackedThisRound.Contains(selectedByUser))
             {
                 if (args["action"] == "Add Attack Target")
                 {
                     if (CombatHolder._inCombatChars.Any(A => A.CombatStuff.CombatName == args["selectedtargets"]))
                     {
                         selectedByUser.CombatStuff.targets.Add(CombatHolder._inCombatChars.Find(A => A.CombatStuff.CombatName == args["selectedtargets"]));
                     }
                 }
                 if (args["action"] == "Remove Attack Target")
                 {
                     if (selectedByUser.CombatStuff.targets.Any(A => A.CombatStuff.CombatName == args["selectedtargets"]))
                     {
                         selectedByUser.CombatStuff.targets.Remove(selectedByUser.CombatStuff.targets.Find(A => A.CombatStuff.CombatName == args["selectedtargets"]));
                     }
                 }
             }
         }
     }
     if (args.ContainsKey("selectedspelltargets"))
     {
         selectedByUser.LastSpellTargetSelected = args["selectedspelltargets"];
         if (args.ContainsKey("action"))
         {
             if (args["action"] == "Add Spell Target")
             {
                 if (CombatHolder._inCombatChars.Any(A => A.CombatStuff.CombatName == args["selectedspelltargets"]))
                 {
                     selectedByUser.CombatStuff.SpellsToCast[0].targets.Add(CombatHolder._inCombatChars.Find(A => A.CombatStuff.CombatName == args["selectedspelltargets"]));
                 }
             }
             if (args["action"] == "Remove Spell Target")
             {
                 if (selectedByUser.CombatStuff.SpellsToCast[0].targets.Any(A => A.CombatStuff.CombatName == args["selectedspelltargets"]))
                 {
                     selectedByUser.CombatStuff.SpellsToCast[0].targets.Remove(selectedByUser.CombatStuff.SpellsToCast[0].targets.Find(A => A.CombatStuff.CombatName == args["selectedspelltargets"]));
                 }
             }
         }
     }
     if (args.ContainsKey("spellpower"))
     {
         double d;
         Double.TryParse(args["spellpower"], out d);
         selectedByUser.CombatStuff.SpellsToCast[0].spellPower = d;
     }
     if (args.ContainsKey("selectedspell"))
     {
         selectedByUser.CombatStuff.SpellsToCast[0].spell = selectedByUser.Spells.Find(A => A.SpellName == args["selectedspell"]);
     }
     if (args.ContainsKey("offbonus"))
     {
         double d;
         Double.TryParse(args["offbonus"], out d);
         selectedByUser.CombatStuff.CombatOB = d;
     }
     if (args.ContainsKey("defbonus"))
     {
         double d;
         Double.TryParse(args["defbonus"], out d);
         selectedByUser.CombatStuff.CombatDB = d;
     }
     if (args.ContainsKey("roll"))
     {
         double d;
         Double.TryParse(args["roll"], out d);
         selectedByUser.CombatStuff.CombatRoll = d;
     }
     if (!CombatHolder._alreadyAttackedThisRound.Contains(selectedByUser) &&
         !CombatHolder._makingAttackChars.Contains(selectedByUser) &&
         selectedByUser.CombatStuff.targets.Any())
     {
         CombatHolder.toggleCharAttack(selectedByUser);
     }
     if (CombatHolder._makingAttackChars.Contains(selectedByUser) &&
         !selectedByUser.CombatStuff.targets.Any())
     {
         CombatHolder.toggleCharAttack(selectedByUser);
     }
     selectedByUser.CombatStuff.readyForCombat         = true;
     selectedByUser.CombatStuff.rollSet                = true;
     selectedByUser.CombatStuff.SpellsToCast[0].caster = selectedByUser;
     return(HTMLWriter.CombatTerminal(selectedByUser));
 }