コード例 #1
0
ファイル: PassivityProcessor.cs プロジェクト: arkanoid1/Temu
        private static void ApplyPassivity(Player player, Condition condition, Passivity passivity, AttackResult result)
        {
            if(!CheckCondition(condition, passivity))
                return;

            if(passivity.Probability >= 0.001f && 1.0f - passivity.Probability > 0.001f)
                if(RandomUtilities.Random().Next(0, 100) > passivity.Probability*100)
                    return;
                
            switch (passivity.Type)
            {
                // Damage block
                case 109:
                    if (result.AttackType != AttackType.Normal || !result.Target.EffectsImpact.IsBlockFrontAttacks)
                        return;

                    if (result.AngleDif < 135 || passivity.Value < result.Damage)
                        return;

                    result.Damage = 0;
                    result.AttackType = AttackType.Block;
                    break;

                // Heal modifier
                case 168:
                case 169:
                    switch (passivity.Method)
                    {
                        case 2:
                            result.HpDiff += (int)passivity.Value;
                            break;
                        case 3:
                            result.HpDiff = (int)passivity.Value * result.HpDiff;
                            break;
                    }
                    break;

                // Do more damage when attack ...
                case 152:
                    if (passivity.MobSize != NpcSize.All)
                    {
                        if (result.Target is Player && passivity.MobSize != NpcSize.Player)
                            return;

                        if (result.Target is Npc && ((Npc)result.Target).NpcTemplate.Size != passivity.MobSize)
                            return;
                    }

                    switch (passivity.Method)
                    {
                        case 2:
                            result.Damage += (int)passivity.Value;
                            break;
                        case 3:
                            result.Damage = (int)(passivity.Value * result.Damage);
                            break;
                    }
                    break;

                // Chance to regenerate MP when combat starts.
                case 207:
                    Communication.Global.FeedbackService.MpChanged(player, (int)passivity.Value, player);
                    break;
            }
        }
コード例 #2
0
ファイル: PassivityProcessor.cs プロジェクト: arkanoid1/Temu
        private static bool CheckCondition(Condition condition, Passivity passivity)
        {
            switch (passivity.Type)
            {
                // Damage block
                case 109:
                    return condition == Condition.Attacked;

                // Heal modifier
                case 168:
                    return condition == Condition.Heal;

                // Receive more healing
                case 169:
                    return condition == Condition.Healed;

                // Chance to regenerate MP when combat starts.
                case 207:
                    return condition == Condition.BattleEnter;

                // Do more damage when attack ...
                case 152:
                    return condition == Condition.Attack;

                default:
                    return false;
            }
        }