Esempio n. 1
0
        void rollInitiative()
        {
            lblTarget.Text = "";
            target         = null;
            RollerClass r = new RollerClass();

            foreach (CharacterClass c in goodList)
            {
                // + " " + r.displayInitiative(c.Initiative, c.Reaction);
                c.weaponList.Enabled = true;
                c.modeList.Enabled   = true;
                EventClass.LogEvent(new EventLogArgs(EventLogArgs.LogEntryTypeEnum.INITIATIVE, c.Name + " initiative is " + c.curInitiative + " " + r.displayInitiative(c.Initiative, c.Reaction)));
                c.curInitiative = r.Initative;
                c.label.Text    = c.getLabel() + " (" + r.Initative + ")";
            }
            foreach (CharacterClass c in badList)
            {
                // + " " + r.displayInitiative(c.Initiative, c.Reaction);
                c.weaponList.Enabled = true;
                c.modeList.Enabled   = true;
                EventClass.LogEvent(new EventLogArgs(EventLogArgs.LogEntryTypeEnum.INITIATIVE, c.Name + " initiative is " + c.curInitiative + " " + r.displayInitiative(c.Initiative, c.Reaction)));
                c.curInitiative = r.Initative;
                c.label.Text    = c.getLabel() + " (" + r.Initative + ")";
            }
            List <CharacterClass> allList = new List <CharacterClass>();

            allList.AddRange(goodList);
            allList.AddRange(badList);
            InitiativeOrder = new List <CharacterClass>();
            InitiativeOrder = allList.OrderByDescending(x => x.curInitiative).ToList();
            CreateGoButton();
        }
Esempio n. 2
0
        void resolveCombat(CharacterClass c, CharacterClass t)
        {
            int         i               = 0;
            DamageClass charWeapon      = DamageClass.getActiveWeapon(c);
            int         charWeaponSkill = SkillClass.getSkill(c, charWeapon);
            int         charAttribute   = c.getAttributeSkillValue(charWeapon);
            // DamageClass targetWeapon = DamageClass.getActiveWeapon(t);
            //int targetWeaponSkill = SkillClass.getSkill(t, targetWeapon);
            //int targetAttribute = c.getAttributeSkillValue(targetWeapon);

            RollerClass r           = new RollerClass();
            List <int>  charRolls   = r.Roll(charWeaponSkill + charAttribute, 0);
            int         charSuccess = r.returnSuccesses(charRolls);

            List <int> targetRolls   = r.Roll(t.Reaction + t.Intuition, 0);
            int        targetSuccess = r.returnSuccesses(targetRolls);

            int netSuccesses = charSuccess - targetSuccess;

            EventClass.LogEvent(c.Name + " attack rolls (" + charSuccess + ")  " + r.displayRolls(charRolls));
            EventClass.LogEvent(t.Name + " defense rolls (" + targetSuccess + ")  " + r.displayRolls(targetRolls));
            if (netSuccesses > 0)
            {
                List <int> targetResistRolls   = r.Roll(t.Body + t.Armor - charWeapon.armorPen, 0);
                int        targetResistSuccess = r.returnSuccesses(targetResistRolls);
                EventClass.LogEvent(t.Name + " resist rolls (" + targetResistSuccess + ")  " + r.displayRolls(targetResistRolls));
                int dv     = charWeapon.baseDamage + netSuccesses;
                int damage = dv - targetResistSuccess;
                EventClass.LogEvent(c.Name + " dv = " + dv + "  damage = " + damage);
                if (dv >= (t.Armor - charWeapon.armorPen))
                {
                    //t.Health -= damage;
                    EventClass.LogEvent(c.Name + " did physical damage of " + damage + " to " + t.Name);
                }
                else
                {
                    //t.Stun -= damage;
                    EventClass.LogEvent(c.Name + " did stun damage of " + damage + " to " + t.Name);
                }
            }
            else
            {
                EventClass.LogEvent(c.Name + " missed " + t.Name);
            }
        }