Beispiel #1
0
    // Check all units to handle spells triggered by a combat event.
    internal void HandleCombatEvent(CombatEvent combatEvent)
    {
        CombatEventDispatcher dispatcher = new CombatEventDispatcher(this);

        foreach (PartyPosition position in SkillUsageOrder)
        {
            Skill offenseSkill = OffenseParty.GetAssignedSkill(position);
            if (offenseSkill != null && offenseSkill.SkillDefinition.PerformedPhase == CombatPhase.ReactionPhase)
            {
                ISkillTriggering triggering = offenseSkill.SkillDefinition.Triggering;
                if (triggering != null && triggering.CanReact(dispatcher, offenseSkill.Owner, combatEvent))
                {
                    // Trigger skill.
                    ResolveSkill(GetCombatUnit(CombatPartyType.Offense, position));
                }
            }

            Skill defenseSkill = DefenseParty.GetAssignedSkill(position);
            if (defenseSkill != null && defenseSkill.SkillDefinition.PerformedPhase == CombatPhase.ReactionPhase)
            {
                ISkillTriggering triggering = defenseSkill.SkillDefinition.Triggering;
                if (triggering != null && triggering.CanReact(dispatcher, defenseSkill.Owner, combatEvent))
                {
                    // Trigger skill.
                    ResolveSkill(GetCombatUnit(CombatPartyType.Defense, position));
                }
            }
        }
    }
Beispiel #2
0
    public void GenerateAllCombatEvents()
    {
        _CombatEventLog.Clear();
        InitializeCombatStatus();

        // Figure out the action order.
        // Iterate through each phase to see if any action is triggered.
        for (CombatPhase phase = CombatPhase.PreparationPhase; phase <= CombatPhase.RecoveryPhase; ++phase)
        {
            foreach (PartyPosition position in SkillUsageOrder)
            {
                Skill offenseSkill = OffenseParty.GetAssignedSkill(position);
                if (offenseSkill != null && offenseSkill.SkillDefinition.PerformedPhase == phase)
                {
                    ResolveSkill(GetCombatUnit(CombatPartyType.Offense, position));
                }

                Skill defenseSkill = DefenseParty.GetAssignedSkill(position);
                if (defenseSkill != null && defenseSkill.SkillDefinition.PerformedPhase == phase)
                {
                    ResolveSkill(GetCombatUnit(CombatPartyType.Defense, position));
                }
            }
        }
    }
Beispiel #3
0
 internal CombatPartyType GetUnitParty(Unit unit)
 {
     if (OffenseParty.IsPartyMember(unit))
     {
         return(CombatPartyType.Offense);
     }
     else if (DefenseParty.IsPartyMember(unit))
     {
         return(CombatPartyType.Defense);
     }
     return(CombatPartyType.None);
 }