コード例 #1
0
        public static bool IsCondition(AICondition condition, Prop prop, Power p = null)
        {
            bool      isTrue = true;
            Character ch     = prop as Character;

            switch (condition.type)
            {
            case AIConditionType.Held: isTrue = ch == null || ch.isHeld(); break;

            case AIConditionType.Rooted: isTrue = ch == null || ch.isRooted(); break;

            case AIConditionType.Health: isTrue = prop.GetHealthPct() < condition.threshold; break;

            case AIConditionType.Energy: isTrue = ch == null || ch.GetEnergyPct() < condition.threshold; break;

            case AIConditionType.Random: isTrue = Random.Range(0, 100) < condition.threshold; break;

            case AIConditionType.Shielded: isTrue = p && prop.stats[RPGSettings.GetResistanceStat(p.type)].currentValue > condition.threshold; break;

            case AIConditionType.Boosted: isTrue = p && ch && ch.stats[RPGSettings.GetDamageStat(p.type)].currentValue > condition.threshold; break;

            case AIConditionType.Status: isTrue = prop.GetStacks(condition.status) > 0; break;
            }
            if (condition.reverse)
            {
                isTrue = !isTrue;
            }
            return(isTrue);
        }
コード例 #2
0
ファイル: Conversion.cs プロジェクト: DrMikeCooper/RPG
        public override void Apply(Prop ch, Character caster = null)
        {
            Prop sourceCh  = applyFromCaster ? caster : ch;
            int  numStacks = sourceCh.GetStacks(source);

            if (consume)
            {
                sourceCh.RemoveStatus(source);
            }

            Prop target = applyToCaster ? caster : ch;

            if (numStacks > 0 && target)
            {
                if (stacksScaleDuration)
                {
                    duration *= numStacks;
                }
                float power = stacksScalePower ? numStacks : 1.0f;
                target.ApplyStatus(resultStatus, duration, caster, null, power);
            }
        }