Пример #1
0
 public void handleEffectModMP(EffectHandlerModMP handler, Entity origin, Entity target)
 {
     modMPEntity(origin, target, handler.MP * handler.direction);
 }
Пример #2
0
        public static EffectHandler buildEffectHandler(ObjectJSON effectHandler)
        {
            EffectHandler output;

            if (effectHandler != null && effectHandler.containsValue("class"))   // should always contain it
            {
                string className = effectHandler.getString("class");
                if (className == "EffectHandlerDirectDamage")
                {
                    output = new EffectHandlerDirectDamage();
                    ((EffectHandlerDirectDamage)output).damage = effectHandler.getInt("damage");
                }
                else if (className == "EffectHandlerIndirectDamage")
                {
                    output = new EffectHandlerIndirectDamage();
                    ((EffectHandlerIndirectDamage)output).damage = effectHandler.getInt("damage");
                }
                else if (className == "EffectHandlerHeal")
                {
                    output = new EffectHandlerHeal();
                    ((EffectHandlerHeal)output).heal = effectHandler.getInt("heal");
                }
                else if (className == "EffectHandlerBuff")
                {
                    output = new EffectHandlerBuff();
                    ((EffectHandlerBuff)output).buffId   = effectHandler.getString("buffId");
                    ((EffectHandlerBuff)output).duration = effectHandler.getInt("duration");
                }
                else if (className == "EffectHandlerModMP")
                {
                    output = new EffectHandlerModMP();
                    ((EffectHandlerModMP)output).MP        = effectHandler.getInt("MP");
                    ((EffectHandlerModMP)output).direction = effectHandler.getInt("direction");
                }
                else if (className == "EffectHandlerModAP")
                {
                    output = new EffectHandlerModAP();
                    ((EffectHandlerModAP)output).AP        = effectHandler.getInt("AP");
                    ((EffectHandlerModAP)output).direction = effectHandler.getInt("direction");
                }
                else if (className == "EffectHandlerModRange")
                {
                    output = new EffectHandlerModRange();
                    ((EffectHandlerModRange)output).range = effectHandler.getInt("range");
                }
                else if (className == "EffectHandlerStun")
                {
                    output = new EffectHandlerStun();
                }
                else if (className == "EffectHandlerUnstun")
                {
                    output = new EffectHandlerUnstun();
                }
                else if (className == "EffectHandlerPush")
                {
                    output = new EffectHandlerPush();
                    ((EffectHandlerPush)output).distance = effectHandler.getInt("distance");
                }
                else if (className == "EffectHandlerPull")
                {
                    output = new EffectHandlerPull();
                    ((EffectHandlerPull)output).distance = effectHandler.getInt("distance");
                }
                else if (className == "EffectHandlerDash")
                {
                    output = new EffectHandlerDash();
                }
                else if (className == "EffectHandlerWarp")
                {
                    output = new EffectHandlerWarp();
                }
                else
                {
                    output = null;
                }
                return(output);
            }
            else
            {
                return(null);
            }
        }