private void comboBoxEffectableTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Utilities.EffectableTypes.Character == (Utilities.EffectableTypes)comboBoxEffectableTypes.SelectedItem)
            {
                List <String> names = Utilities.GetCharacterNames();
                foreach (string combatName in CombatHolder.getInCombatCharNames())
                {
                    names.Add(combatName);
                }
                names.Insert(0, "");
                cboBoxName.DataSource = names;
            }
            else
            {
                Item itToReadFrom = new Item();

                if (comboBoxEffectableTypes.Text == "Item")
                {
                    cboBoxName.DataSource = Utilities.GetItemNames();
                }
                if (comboBoxEffectableTypes.Text == "Shield")
                {
                    cboBoxName.DataSource = Utilities.GetShieldNames();
                }
                if (comboBoxEffectableTypes.Text == "Weapon")
                {
                    cboBoxName.DataSource = Utilities.GetWeaponNames();
                }
                if (comboBoxEffectableTypes.Text == "Armor")
                {
                    cboBoxName.DataSource = Utilities.GetArmorNames();
                }
            }
        }
 public CombatEntry()
 {
     InitializeComponent();
     cboBoxNames.DataSource    = Utilities.GetCharacterNames();
     cboBoxInCombat.DataSource = CombatHolder.getInCombatCharNames();
     updateRTBWithCharacternames();
 }
 public MasterDeclarations()
 {
     InitializeComponent();
     cboBoxName.DataSource = CombatHolder.getInCombatCharNames();
     UpdateRTB();
     CombatHolder.updateCombatDeclarations();
     CombatHolder._masterOfDeclarations = this;
 }
 //update character
 private void button1_Click(object sender, EventArgs e)
 {
     foreach (Character update in CombatHolder._inCombatChars)
     {
         Character c = Utilities.GetCharByName(update.Name);
         CombatHolder.UpdateCharInventorySpellsSkillsEffectsAndStats(c);
     }
     updateRTBWithCharacternames();
     cboBoxInCombat.DataSource = CombatHolder.getInCombatCharNames();
 }
Exemple #5
0
 public static void RemoveEffect(Effect toRem, Character c, bool isPermanent)
 {
     Utilities.forceTypesToConformToTag(toRem);
     if (isPermanent)
     {
         Effect toRemFromChar = c.Effects.Find(A => A.Equals(toRem));
         c.Effects.Remove(toRemFromChar);
         Utilities.SaveCharacter(c);
         CombatHolder.UpdateCharInventorySpellsSkillsEffectsAndStats(c);
     }
     else
     {
         Effect toRemFromChar = c.TemporaryEffects.Find(A => A.Equals(toRem));
         c.TemporaryEffects.Remove(toRemFromChar);
     }
 }
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            if (cboBoxInCombat.Text == "")
            {
                MessageBox.Show("Please Enter A Character");
                return;
            }
            Character found = CombatHolder._inCombatChars.Find(FitChar => cboBoxInCombat.Text == FitChar.CombatStuff.CombatName);

            if (found != null)
            {
                CombatHolder._inCombatChars.Remove(found);
            }
            updateRTBWithCharacternames();
            cboBoxInCombat.DataSource = CombatHolder.getInCombatCharNames();
        }
Exemple #7
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();
     }
 }
        //next round
        private void button3_Click(object sender, EventArgs e)
        {
            CombatHolder._alreadyAttackedThisRound.Clear();

            int rounds = 1;

            Int32.TryParse(textBoxRoundsToJump.Text, out rounds);
            if (rounds < 1)
            {
                rounds = 1;
            }
            textBoxRoundsToJump.Text = "";
            for (int i = 0; i < rounds; i++)
            {
                EffectHolder.ProcAndDecayEffects();
                foreach (Character c in CombatHolder._inCombatChars)
                {
                    EnchantmentUtilities.triggerAllEnchantmentsForChar(c, new EnchantmentParameters()
                    {
                        triggerSource = EnchantmentUtilities.SourceTypes.Round
                    });
                    foreach (SpellToCast stc in c.CombatStuff.SpellsToCast)
                    {
                        if (stc != null)
                        {
                            stc.hasBeenCast = false;
                            if (!stc.castAtBeginningOfNextRound)
                            {
                                stc.spellPower = -1;
                            }
                        }
                    }
                }
                if (rounds < 10)
                {
                    SpellResults frmCreator = new SpellResults(false);
                }
                CombatScripts.slowlyRegenerateCharacters();
                CombatScripts.removeOverhealFromCharacters();
            }



            UpdateRTB();
            CombatHolder.updateCombatDeclarations();
        }
        private void FOLLOWTHETACO_Click(object sender, EventArgs e)
        {
            List <AttackOutcome> followedTacos = new List <AttackOutcome>();

            foreach (AttackOutcome tacoToFollow in allAttacks)
            {
                AttackOutcome followedTaco = CombatScripts.RunCombat(tacoToFollow.Attacker, tacoToFollow.Defender, tacoToFollow.attackRoll, tacoToFollow.defendRoll, null);


                followedTaco.Attacker.CombatStuff.AttackNotes = followedTaco.Notes;
                followedTaco.Defender.CombatStuff.DefendNotes = followedTaco.Notes;

                followedTacos.Add(followedTaco);
            }

            CombatScripts.fatigueCharactersAndRecordCombat(followedTacos);

            foreach (AttackOutcome Whack in followedTacos)
            {
                CombatScripts.applyAttackOutcome(Whack);
            }

            EffectHolder.ClearUselessEffects();
            CombatHolder.MoveAttackingCharsToHasAttackedChars();
            if (CombatHolder._masterOfDeclarations != null)
            {
                CombatHolder._masterOfDeclarations.UpdateRTB();
            }
            CombatHolder.updateCombatDeclarations();
            AfterCrits frmCreator = new AfterCrits();

            frmCreator.Show();

            Master_Attacker frmCloser = this;

            frmCloser.Hide();
        }
        //add character
        private void button3_Click(object sender, EventArgs e)
        {
            if (cboBoxNames.Text == "")
            {
                MessageBox.Show("Please Enter A Character");
                return;
            }
            Character charToAdd = Utilities.GetCharByName(cboBoxNames.Text);

            if (!charToAdd.Weapons.Any() || !charToAdd.Shields.Any())
            {
                return;
            }
            charToAdd.CombatStuff.CombatWeapon = charToAdd.Weapons[0];
            charToAdd.CombatStuff.CombatShield = charToAdd.Shields[0];
            List <Character> found = CombatHolder._inCombatChars.FindAll(FitChar => cboBoxNames.Text == FitChar.Name);
            int appendnum          = found.Count + 1;

            //while there is a character that has the same combatname
            while (CombatHolder._inCombatChars.FindAll(FitChar => charToAdd.Name + appendnum == FitChar.CombatStuff.CombatName).Count != 0)
            {
                appendnum++;
            }
            charToAdd.CombatStuff.CombatName = charToAdd.Name + appendnum;
            charToAdd.Stamina             = CombatScripts.GetBaseStamina(charToAdd);
            charToAdd.HitPoints           = CombatScripts.GetBaseHealth(charToAdd);
            charToAdd.CombatStuff.targets = new List <Character>();
            CombatHolder._inCombatChars.Add(charToAdd);

            EnchantmentUtilities.triggerAllEnchantmentsForChar(charToAdd, new EnchantmentParameters()
            {
                triggerSource = EnchantmentUtilities.SourceTypes.CombatEntry
            });

            updateRTBWithCharacternames();
            cboBoxInCombat.DataSource = CombatHolder.getInCombatCharNames();
        }
        private void resolveSpells(bool updateboxes)
        {
            foreach (SpellToCast stc in spells)
            {
                foreach (Effect eff in stc.effectResult.Keys)
                {
                    EffectHolder.CreateEffect(eff, stc.effectResult[eff], false);
                }
                foreach (AttackOutcome ao in stc.weaponResult)
                {
                    CombatScripts.applyAttackOutcome(ao);
                }
                stc.caster.Stamina -= stc.spell.SpellCost;
                attemptToAddResult(stc.caster, stc);
                foreach (Character c in stc.targets)
                {
                    attemptToAddResult(c, stc);
                }
                stc.targets.Clear();
                stc.spellPower = 0;
            }
            EffectHolder.ClearUselessEffects();

            if (updateboxes)
            {
                if (CombatHolder._masterOfDeclarations != null)
                {
                    CombatHolder._masterOfDeclarations.UpdateRTB();
                }
                CombatHolder.updateCombatDeclarations();
            }

            SpellResults frmCloser = this;

            frmCloser.Hide();
        }
Exemple #12
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));
 }
 //get data from google sheets
 private void btnInternet_Click(object sender, EventArgs e)
 {
     //CombatHolder.readCharsFromGoogle(true);
     UpdateRTB();
     CombatHolder.updateCombatDeclarations();
 }
 //run attacks
 private void button2_Click(object sender, EventArgs e)
 {
     CombatHolder.updateCombatDeclarations();
     CombatHolder.attemptToBeginCombat();
 }
Exemple #15
0
        public static void CreateEffect(Effect toAdd, Character c, bool isPermanent)
        {
            Utilities.forceTypesToConformToTag(toAdd);
            if (toAdd.effectStrength > 0)
            {
                List <Effect> toDecFrom = new List <Effect>();
                if (isPermanent)
                {
                    toDecFrom = c.Effects;
                }
                else
                {
                    toDecFrom = c.TemporaryEffects;
                }
                switch (toAdd.effectTag)
                {
                case EffectHolder.EffectTag.Bleed:
                    DecrementTaggedEffect(toAdd, true, toDecFrom);
                    Utilities.SaveCharacter(c);
                    CombatHolder.UpdateCharInventorySpellsSkillsEffectsAndStats(c);
                    return;

                case EffectHolder.EffectTag.Trauma:
                    DecrementTaggedEffect(toAdd, true, toDecFrom);
                    Utilities.SaveCharacter(c);
                    CombatHolder.UpdateCharInventorySpellsSkillsEffectsAndStats(c);
                    return;

                case EffectHolder.EffectTag.BoneImpairment:
                    DecrementTaggedEffect(toAdd, false, toDecFrom);
                    Utilities.SaveCharacter(c);
                    CombatHolder.UpdateCharInventorySpellsSkillsEffectsAndStats(c);
                    return;

                case EffectHolder.EffectTag.MuscleImpairment:
                    DecrementTaggedEffect(toAdd, false, toDecFrom);
                    Utilities.SaveCharacter(c);
                    CombatHolder.UpdateCharInventorySpellsSkillsEffectsAndStats(c);
                    return;

                case EffectHolder.EffectTag.NerveImpairment:
                    DecrementTaggedEffect(toAdd, false, toDecFrom);
                    Utilities.SaveCharacter(c);
                    CombatHolder.UpdateCharInventorySpellsSkillsEffectsAndStats(c);
                    return;

                case EffectHolder.EffectTag.Disorientation:
                    DecrementTaggedEffect(toAdd, true, toDecFrom);
                    Utilities.SaveCharacter(c);
                    CombatHolder.UpdateCharInventorySpellsSkillsEffectsAndStats(c);
                    return;

                case EffectHolder.EffectTag.NoTag:
                    break;
                }
            }
            if (isPermanent)
            {
                c.Effects.Add(toAdd);
                Utilities.SaveCharacter(c);
                CombatHolder.UpdateCharInventorySpellsSkillsEffectsAndStats(c);
            }
            else
            {
                c.TemporaryEffects.Add(toAdd);
            }
        }