public void Trigger(PartyMember partyMember, PartyBattleLayout partyBattleLayout)
        {
            int damage = partyMember.CalculateDamageTaken(this);
            if (damage > 0)
                partyMember.DoDamage(damage, true, false);
            if (partyMember.Alive)
                partyMember.ApplyStatusEffectsFromAttributes(setter, Attributes, battle);

            if (Attributes.Enhancement == Enhancement.Explosive)
            {
                ParticleEffect.AddExplosion(entity.GetCenter(), battle);
                List<PartyMember> partyMemberList = partyBattleLayout.GetListBehindTrap(this);
                if (partyMemberList != null && partyMemberList.Count > 0)
                {
                    PartyMember frontPartyMember = partyMemberList[0];
                    damage = frontPartyMember.CalculateDamageTaken(this);
                    frontPartyMember.DoDamage(damage, false);
                    if (frontPartyMember.Alive)
                        frontPartyMember.ApplyStatusEffectsFromAttributes(setter, Attributes, battle);
                }
            }
            else
                ParticleEffect.AddSmokePuff(entity.GetCenter(), battle);

            partyBattleLayout.RemoveTrap(this);
            Kill();
        }
Beispiel #2
0
        private void TriggerTrap(PartyMember actor, PartyMember target)
        {
            PartyBattleLayout battleLayout = battle.GetPartyBattleLayoutForPartyMember(target);
            Trap trap = battleLayout.GetTrapInFrontOfPartyMember(target);

            if (trap != null)
            {
                trap.Trigger(actor, battleLayout);
            }
        }
Beispiel #3
0
 public void InitPartyBattleLayout(string arrangement = null, bool random = false, int minSize = -1)
 {
     BattleLayout = new PartyBattleLayout(this, minSize);
     if (arrangement != null)
     {
         BattleLayout.ArrangeFromString(arrangement);
     }
     else if (random)
     {
         BattleLayout.ArrangeRandomly();
     }
 }
Beispiel #4
0
        private List <PartyMember> getTargetsFromEnhancement(PartyMember target, Enhancement enhancement)
        {
            PartyBattleLayout  layout = battle.GetPartyBattleLayoutForPartyMember(target);
            List <PartyMember> result;

            switch (enhancement)
            {
            case Enhancement.Piercing:
                List <PartyMember> list = layout.GetListWithPartyMember(target);
                result = new List <PartyMember>(2);
                result.Add(list[0]);
                if (list.Count > 1)
                {
                    result.Add(list[1]);
                }
                break;

            case Enhancement.Relentless:
                result = new List <PartyMember>(layout.GetListWithPartyMember(target)); // new list isn't created in PartyBattleLayout#PartyMembersList
                break;

            case Enhancement.Explosive:
                result = layout.PartyMembersArea(target);
                break;

            case Enhancement.Inaccurate:
                const double chanceOfMiss = 0.4;
                result = new List <PartyMember>(1);
                if (Game1.Random.NextDouble() <= chanceOfMiss)
                {
                    List <PartyMember> targetList = layout.GetListWithPartyMember(target);
                    List <PartyMember> otherList  = layout.RelativeList(targetList, Game1.Random.Next(1) == 0 ? 1 : -1);
                    if (otherList != null && otherList.Count > 0)
                    {
                        result.Add(otherList[0]);
                    }
                }
                else
                {
                    result.Add(target);
                }
                break;

            default:
                result = new List <PartyMember>(1);
                result.Add(target);
                break;
            }
            return(result);
        }
Beispiel #5
0
        public void Trigger(PartyMember partyMember, PartyBattleLayout partyBattleLayout)
        {
            int damage = partyMember.CalculateDamageTaken(this);

            if (damage > 0)
            {
                partyMember.DoDamage(damage, true, false);
            }
            if (partyMember.Alive)
            {
                partyMember.ApplyStatusEffectsFromAttributes(setter, Attributes, battle);
            }

            if (Attributes.Enhancement == Enhancement.Explosive)
            {
                ParticleEffect.AddExplosion(entity.GetCenter(), battle);
                List <PartyMember> partyMemberList = partyBattleLayout.GetListBehindTrap(this);
                if (partyMemberList != null && partyMemberList.Count > 0)
                {
                    PartyMember frontPartyMember = partyMemberList[0];
                    damage = frontPartyMember.CalculateDamageTaken(this);
                    frontPartyMember.DoDamage(damage, false);
                    if (frontPartyMember.Alive)
                    {
                        frontPartyMember.ApplyStatusEffectsFromAttributes(setter, Attributes, battle);
                    }
                }
            }
            else
            {
                ParticleEffect.AddSmokePuff(entity.GetCenter(), battle);
            }

            partyBattleLayout.RemoveTrap(this);
            Kill();
        }