Beispiel #1
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);
            }
        }
Beispiel #2
0
        public static EffectCondition buildEffectCondition(ObjectJSON condition)
        {
            EffectCondition output;

            if (condition != null && condition.containsValue("class"))   // should always contain it
            {
                string className = condition.getString("class");
                if (className == "EffectConditionTurnNumberAbove")
                {
                    output = new EffectConditionTurnNumberAbove();
                    ((EffectConditionTurnNumberAbove)output).turnNumber = condition.getInt("turnNumber");
                }
                else if (className == "EffectConditionTurnNumberBelow")
                {
                    output = new EffectConditionTurnNumberBelow();
                    ((EffectConditionTurnNumberBelow)output).turnNumber = condition.getInt("turnNumber");
                }
                else if (className == "EffectConditionHealthAbove")
                {
                    output = new EffectConditionHealthAbove();
                    ((EffectConditionHealthAbove)output).target  = EffectConditionTarget.stringToConditionTarget(condition.getString("target"));
                    ((EffectConditionHealthAbove)output).health  = condition.getInt("health");
                    ((EffectConditionHealthAbove)output).percent = condition.getBool("percent");
                }
                else if (className == "EffectConditionHealthBelow")
                {
                    output = new EffectConditionHealthBelow();
                    ((EffectConditionHealthBelow)output).target  = EffectConditionTarget.stringToConditionTarget(condition.getString("target"));
                    ((EffectConditionHealthBelow)output).health  = condition.getInt("health");
                    ((EffectConditionHealthBelow)output).percent = condition.getBool("percent");
                }
                else if (className == "EffectConditionAPAbove")
                {
                    output = new EffectConditionAPAbove();
                    ((EffectConditionAPAbove)output).target  = EffectConditionTarget.stringToConditionTarget(condition.getString("target"));
                    ((EffectConditionAPAbove)output).AP      = condition.getInt("AP");
                    ((EffectConditionAPAbove)output).percent = condition.getBool("percent");
                }
                else if (className == "EffectConditionAPBelow")
                {
                    output = new EffectConditionAPBelow();
                    ((EffectConditionAPBelow)output).target  = EffectConditionTarget.stringToConditionTarget(condition.getString("target"));
                    ((EffectConditionAPBelow)output).AP      = condition.getInt("AP");
                    ((EffectConditionAPBelow)output).percent = condition.getBool("percent");
                }
                else if (className == "EffectConditionMPAbove")
                {
                    output = new EffectConditionMPAbove();
                    ((EffectConditionMPAbove)output).target  = EffectConditionTarget.stringToConditionTarget(condition.getString("target"));
                    ((EffectConditionMPAbove)output).MP      = condition.getInt("MP");
                    ((EffectConditionMPAbove)output).percent = condition.getBool("percent");
                }
                else if (className == "EffectConditionMPBelow")
                {
                    output = new EffectConditionMPBelow();
                    ((EffectConditionMPBelow)output).target  = EffectConditionTarget.stringToConditionTarget(condition.getString("target"));
                    ((EffectConditionMPBelow)output).MP      = condition.getInt("MP");
                    ((EffectConditionMPBelow)output).percent = condition.getBool("percent");
                }
                else if (className == "EffectConditionHasBuff")
                {
                    output = new EffectConditionHasBuff();
                    ((EffectConditionHasBuff)output).target = EffectConditionTarget.stringToConditionTarget(condition.getString("target"));
                    ((EffectConditionHasBuff)output).buffId = condition.getString("buffId");
                }
                else if (className == "EffectConditionHasNotBuff")
                {
                    output = new EffectConditionHasNotBuff();
                    ((EffectConditionHasNotBuff)output).target = EffectConditionTarget.stringToConditionTarget(condition.getString("target"));
                    ((EffectConditionHasNotBuff)output).buffId = condition.getString("buffId");
                }
                else
                {
                    output = null;
                }
                return(output);
            }
            else
            {
                return(null);
            }
        }