Пример #1
0
    public void GetTargets(CombatResolver resolver, CombatUnit user, List <CombatUnit> targets)
    {
        CombatPartyType targetParty = TargetAllyParty ? user.CombatParty : user.OpponentParty;

        CombatUnit targetUnit = null;

        if (ByPercentage)
        {
            float percentage = 0.0f;
            // Go through each position in standard targeting order, such that if multiple units have the same percentage,
            // it prioritize the unit with standard targeting order.
            foreach (PartyPosition position in StandardSingleTargeting.SkillTargetOrder)
            {
                CombatUnit member = resolver.GetCombatUnit(targetParty, position);
                if (member != null && !member.Unit.IsDead)
                {
                    float percentageLife = (float)member.Unit.Status.Life / (float)member.Unit.Status.MaxLife;
                    if (targetUnit == null || percentageLife < percentage)
                    {
                        targetUnit = member;
                        percentage = percentageLife;
                    }
                }
            }
        }
        else
        {
            int life = 0;
            // Same prioritization as the percentage case.
            foreach (PartyPosition position in StandardSingleTargeting.SkillTargetOrder)
            {
                CombatUnit member = resolver.GetCombatUnit(targetParty, position);
                if (member != null && !member.Unit.IsDead)
                {
                    if (targetUnit == null || member.Unit.Status.Life < life)
                    {
                        targetUnit = member;
                        life       = member.Unit.Status.Life;
                    }
                }
            }
        }

        if (targetUnit != null)
        {
            targets.Add(targetUnit);
        }
    }
Пример #2
0
    public void GetTargets(CombatResolver resolver, CombatUnit user, List <CombatUnit> targets)
    {
        CombatPartyType targetedParty = TargetAlly ? user.CombatParty : user.OpponentParty;
        CombatUnit      targetedUnit  = resolver.GetCombatUnit(targetedParty, Position);

        if (targetedUnit != null)
        {
            targets.Add(targetedUnit);
        }
    }
Пример #3
0
    public void GetTargets(CombatResolver resolver, CombatUnit user, List <CombatUnit> targets)
    {
        CombatPartyType opponentParty = user.OpponentParty;

        foreach (PartyPosition position in SkillTargetOrder)
        {
            CombatUnit targetUnit = resolver.GetCombatUnit(opponentParty, position);
            if (targetUnit != null && !targetUnit.Unit.IsDead)
            {
                targets.Add(targetUnit);
                break;
            }
        }
    }