コード例 #1
0
 public void SetData(float turnTime, TargetableElement target = null, BattleElement source = null, EffectData sourceEffect = null)
 {
     this.target          = target;
     this.source          = source;
     this.sourceEffect    = sourceEffect;
     this.volatileCounter = turnTime;
 }
コード例 #2
0
        //???? effectData
        //???? modifier
        //???? ceilModifier;

        public Event(string id, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
        {
            this.id     = id;
            this.target = target;
            this.source = source;
            this.effect = effect;
        }
コード例 #3
0
 public EventStatus(EffectData status, string callback, EffectData statusData = null, TargetableElement thing = null, int priority = 0)
 {
     this.status     = status;
     this.callback   = callback;
     this.statusData = statusData;
     this.thing      = thing;
     this.priority   = priority;
 }
コード例 #4
0
 public void Init(Battle b, PokemonSet set, Battle.Team t)
 {
     pokemonData  = new Pokemon(b, set, t, this);
     targetScript = GetComponent <TargetableElement>();
     targetScript.sourceElement = this;
     this.id           = pokemonData.speciesId;
     currentActiveMove = null;
 }
コード例 #5
0
    void OnTriggerEnter(Collider other)
    {
        TargetableElement te = other.gameObject.GetComponent <TargetableElement>();

        if (te != null)
        {
            father.GetComponent <paydayMoveController>().ImpactedWith(te, gameObject);
        }
    }
コード例 #6
0
    void getRelevantEffectsPokemon(List <EventStatus> statuses, TargetableElement thing, string callbackType)
    {
        if (thing == null || !(thing.sourceElement is PokemonCharacter))
        {
            return;
        }
        Pokemon pokeThing = ((PokemonCharacter)thing.sourceElement).pokemonData;

        //Status of pokemon
        EffectData status = pokeThing.GetInfoStatus();

        if (status != null && status.eventMethods.HasCallback(callbackType))
        {
            statuses.Add(new EventStatus(status: status, callback: callbackType, statusData: pokeThing.statusData, thing: thing));
            //resolve
        }

        //Volatiles of pokemon
        foreach (KeyValuePair <string, Volatile> vol in pokeThing.volatiles)
        {
            //vol.key = volatile name
            //vol.value = volatile effect
            if (vol.Value.eventMethods.HasCallback(callbackType))
            {
                statuses.Add(new EventStatus(status: vol.Value, callback: callbackType, statusData: vol.Value, thing: thing));
                //resolve
            }
        }

        //Ability of pokemon
        AbilityData ability = pokeThing.GetInfoAbility();

        if (ability != null && ability.eventMethods.HasCallback(callbackType))
        {
            statuses.Add(new EventStatus(status: ability, callback: callbackType, statusData: pokeThing.abilityData, thing: thing));
            //resolve
        }

        //Item of pokemon
        ItemData item = pokeThing.GetInfoItem();

        if (item != null && item.eventMethods.HasCallback(callbackType))
        {
            statuses.Add(new EventStatus(status: item, callback: callbackType, statusData: pokeThing.itemData, thing: thing));
            //resolve
        }

        //Species of pokemon????

        /*
         * Globals.TemplateData species = thing.baseTemplate;
         *      if (species.eventMethods.HasCallback(callbackType)) {
         *              //push callbacktype
         *  //resolve
         * }
         */
    }
コード例 #7
0
    void getRelevantEffectsBattle(List <EventStatus> statuses, TargetableElement thing, string callbackType)
    {
        //Active moves in battle in contact with thing? (includes pseudoweathers)

        /*
         * foreach (ActiveMove activeMove in activeMoves)
         * {
         *  Globals.EffectData moveData = activeMove.GetInfoEffect();
         *  if (moveData != null && moveData.eventMethods.HasCallback(callbackType))
         *  {
         *      statuses.Add(new EventStatus(status: moveData, callback: callbackType, statusData: activeMove.elementEffectData, thing: this));
         *      //resolvepriority
         *  }
         * }
         */

        /*
         * HERE add foething is Attrezo, or others?
         */

        //Active weather
        if (activeWeather != null)
        {
            EffectData weatherData = activeWeather.GetInfoEffect();
            if (weatherData != null && weatherData.eventMethods.HasCallback(callbackType))
            {
                statuses.Add(new EventStatus(status: weatherData, callback: callbackType, statusData: activeWeather.elementEffectData, thing: activeWeather.targetScript, priority: weatherData.GetValueFromOrderOrPriorityVariable(callbackType + "Priority")));
                //resolvepriority
            }
        }

        //Active terrain
        if (activeTerrain != null)
        {
            EffectData terrainData = activeTerrain.GetInfoEffect();
            if (terrainData != null && terrainData.eventMethods.HasCallback(callbackType))
            {
                statuses.Add(new EventStatus(status: terrainData, callback: callbackType, statusData: activeTerrain.elementEffectData, thing: activeTerrain.targetScript, priority: terrainData.GetValueFromOrderOrPriorityVariable(callbackType + "Priority")));
                //resolvepriority
            }
        }

        //Formats

        /*
         * if(somewhatformat != null && somewhatformat.eventMethods.HasCallback(callbackType))
         * {
         *  //push callbackType
         *  //resolvepriority
         * }
         */

        //Extra events (dont know what was that
    }
コード例 #8
0
 void getRelevantEffectsTeam(List <EventStatus> statuses, TargetableElement thing, Team thingTeam, string callbackType)
 {
     foreach (ActiveMove activeMove in thingTeam.teamMoves)
     {
         EffectData moveData = activeMove.GetInfoEffect();
         if (moveData != null && moveData.eventMethods.HasCallback(callbackType))
         {
             statuses.Add(new EventStatus(status: moveData, callback: callbackType, statusData: activeMove.elementEffectData, thing: activeMove.targetScript));
             //resolve
         }
     }
 }
コード例 #9
0
    public AbilityData(
        /*EventMethods*/Callbacks.EventCallback basePowerCallback = null, Callbacks.EventCallback beforeMoveCallback = null, Callbacks.EventCallback beforeTurnCallback = null, Callbacks.EventCallback damageCallback = null, Callbacks.EventCallback durationCallback = null, Callbacks.EventCallback onAfterDamage = null, Callbacks.EventCallback onAfterMoveSecondary = null, Callbacks.EventCallback onAfterEachBoost = null, Callbacks.EventCallback onAfterHit = null, Callbacks.EventCallback onAfterSetStatus = null, Callbacks.EventCallback onAfterSwitchInSelf = null, Callbacks.EventCallback onAfterUseItem = null, Callbacks.EventCallback onAfterBoost = null, Callbacks.EventCallback onAfterMoveSecondarySelf = null, Callbacks.EventCallback onAfterMove = null, Callbacks.EventCallback onAfterMoveSelf = null, Callbacks.EventCallback onAllyTryAddVolatile = null, Callbacks.EventCallback onAllyBasePower = null, Callbacks.EventCallback onAllyModifyAtk = null, Callbacks.EventCallback onAllyModifySpD = null, Callbacks.EventCallback onAllyBoost = null, Callbacks.EventCallback onAllySetStatus = null, Callbacks.EventCallback onAllyTryHitSide = null, Callbacks.EventCallback onAllyFaint = null, Callbacks.EventCallback onAllyAfterUseItem = null, Callbacks.EventCallback onAllyModifyMove = null, Callbacks.EventCallback onAnyTryPrimaryHit = null, Callbacks.EventCallback onAnyTryMove = null, Callbacks.EventCallback onAnyDamage = null, Callbacks.EventCallback onAnyBasePower = null, Callbacks.EventCallback onAnySetWeather = null, Callbacks.EventCallback onAnyModifyDamage = null, Callbacks.EventCallback onAnyRedirectTarget = null, Callbacks.EventCallback onAnyAccuracy = null, Callbacks.EventCallback onAnyTryImmunity = null, Callbacks.EventCallback onAnyFaint = null, Callbacks.EventCallback onAnyModifyBoost = null, Callbacks.EventCallback onAnyDragOut = null, Callbacks.EventCallback onAnySetStatus = null, Callbacks.EventCallback onAttract = null, Callbacks.EventCallback onAccuracy = null, Callbacks.EventCallback onFoeAccuracy = null, Callbacks.EventCallback onBasePower = null, Callbacks.EventCallback onTryImmunity = null, Callbacks.EventCallback onBeforeMove = null, Callbacks.EventCallback onBeforeSwitchIn = null, Callbacks.EventCallback onBeforeSwitchOut = null, Callbacks.EventCallback onBeforeTurn = null, Callbacks.EventCallback onBoost = null, Callbacks.EventCallback onChargeMove = null, Callbacks.EventCallback onCheckShow = null, Callbacks.EventCallback onCopy = null, Callbacks.EventCallback onDamage = null, Callbacks.EventCallback onDeductPP = null, Callbacks.EventCallback onDisableMove = null, Callbacks.EventCallback onDragOut = null, Callbacks.EventCallback onEat = null, Callbacks.EventCallback onEatItem = null, Callbacks.EventCallback onEnd = null, Callbacks.EventCallback onFaint = null, Callbacks.EventCallback onFlinch = null, Callbacks.EventCallback onFoeAfterDamage = null, Callbacks.EventCallback onFoeBasePower = null, Callbacks.EventCallback onFoeBeforeMove = null, Callbacks.EventCallback onFoeDisableMove = null, Callbacks.EventCallback onFoeMaybeTrapPokemon = null, Callbacks.EventCallback onFoeModifyDef = null, Callbacks.EventCallback onFoeRedirectTarget = null, Callbacks.EventCallback onFoeSwitchOut = null, Callbacks.EventCallback onFoeTrapPokemon = null, Callbacks.EventCallback onFoeTryMove = null, Callbacks.EventCallback onHit = null, Callbacks.EventCallback onHitField = null, Callbacks.EventCallback onHitSide = null, Callbacks.EventCallback onImmunity = null, Callbacks.EventCallback onLockMove = null, Callbacks.EventCallback onLockMoveTarget = null, Callbacks.EventCallback onModifyAccuracy = null, Callbacks.EventCallback onFoeModifyAccuracy = null, Callbacks.EventCallback onModifyAtk = null, Callbacks.EventCallback onModifyBoost = null, Callbacks.EventCallback onModifyCritRatio = null, Callbacks.EventCallback onModifyDamage = null, Callbacks.EventCallback onModifyDef = null, Callbacks.EventCallback onModifyMove = null, Callbacks.EventCallback onModifyPriority = null, Callbacks.EventCallback onModifySecondaries = null, Callbacks.EventCallback onModifySpA = null, Callbacks.EventCallback onModifySpD = null, Callbacks.EventCallback onModifySpe = null, Callbacks.EventCallback onModifyWeight = null, Callbacks.EventCallback onMoveAborted = null, Callbacks.EventCallback onMoveFail = null, Callbacks.EventCallback onNegateImmunity = null, Callbacks.EventCallback onOverrideAction = null, Callbacks.EventCallback onPrepareHit = null, Callbacks.EventCallback onPreStart = null, Callbacks.EventCallback onPrimal = null, Callbacks.EventCallback onRedirectTarget = null, Callbacks.EventCallback onResidual = null, Callbacks.EventCallback onRestart = null, Callbacks.EventCallback onSetAbility = null, Callbacks.EventCallback onSetStatus = null, Callbacks.EventCallback onSourceAccuracy = null, Callbacks.EventCallback onSourceBasePower = null, Callbacks.EventCallback onSourceFaint = null, Callbacks.EventCallback onSourceHit = null, Callbacks.EventCallback onSourceModifyAccuracy = null, Callbacks.EventCallback onSourceModifyAtk = null, Callbacks.EventCallback onSourceModifyDamage = null, Callbacks.EventCallback onSourceModifySecondaries = null, Callbacks.EventCallback onSourceModifySpA = null, Callbacks.EventCallback onSourceTryHeal = null, Callbacks.EventCallback onSourceTryPrimaryHit = null, Callbacks.EventCallback onStallMove = null, Callbacks.EventCallback onStart = null, Callbacks.EventCallback onSwitchIn = null, Callbacks.EventCallback onSwitchOut = null, Callbacks.EventCallback onTakeItem = null, Callbacks.EventCallback onTerrain = null, Callbacks.EventCallback onTrapPokemon = null, Callbacks.EventCallback onTry = null, Callbacks.EventCallback onTryAddVolatile = null, Callbacks.EventCallback onTryEatItem = null, Callbacks.EventCallback onTryHeal = null, Callbacks.EventCallback onTryHit = null, Callbacks.EventCallback onTryHitField = null, Callbacks.EventCallback onTryHitSide = null, Callbacks.EventCallback onTryMove = null, Callbacks.EventCallback onTryPrimaryHit = null, Callbacks.EventCallback onType = null, Callbacks.EventCallback onUpdate = null, Callbacks.EventCallback onUseMoveMessage = null, Callbacks.EventCallback onWeather = null, Callbacks.EventCallback onWeatherModifyDamage = null, Callbacks.EventCallback onAfterSubDamage = null, Callbacks.EventCallback onEffectiveness = null, Callbacks.EventCallback onFoeDeductPP = null,
        /*EffectData*/ string id = "", string name = "", int num = -1, bool affectsFainted = false, string desc = "", int[] drain = null, int duration = -1, EffectData effect = null, string isZ = "", int onBasePowerPriority = 0,
        /*EffectData (modifier priorities)*/ int onModifyAccuracyPriority = 0, int onModifyAtkPriority = 0, int onModifyCritRatioPriority = 0, int onModifyDefPriority = 0, int onModifyMovePriority = 0, int onModifyPriorityPriority = 0, int onModifySpAPriority = 0, int onModifySpDPriority = 0, int onModifyWeightPriority = 0,
        /*EffectData*/ int onResidualOrder = 0, int[] recoil = null, Globals.SecondaryEffect[] secondaries = null, Globals.SelfEffect self = null, string shortDesc = "",
        /*EffectType*/ Globals.EffectTypes effectType = Globals.EffectTypes.Ability,
        /*Effect*/ bool exists = false,
        /*AbilityData*/ int rating = 0, bool isUnbreakable = false, bool suppressWeather = false)
    {
        /*EventMethods*/
        this.eventMethods = new EventMethods(basePowerCallback, beforeMoveCallback, beforeTurnCallback, damageCallback, durationCallback, onAfterDamage, onAfterMoveSecondary, onAfterEachBoost, onAfterHit, onAfterSetStatus, onAfterSwitchInSelf, onAfterUseItem, onAfterBoost, onAfterMoveSecondarySelf, onAfterMove, onAfterMoveSelf, onAllyTryAddVolatile, onAllyBasePower, onAllyModifyAtk, onAllyModifySpD, onAllyBoost, onAllySetStatus, onAllyTryHitSide, onAllyFaint, onAllyAfterUseItem, onAllyModifyMove, onAnyTryPrimaryHit, onAnyTryMove, onAnyDamage, onAnyBasePower, onAnySetWeather, onAnyModifyDamage, onAnyRedirectTarget, onAnyAccuracy, onAnyTryImmunity, onAnyFaint, onAnyModifyBoost, onAnyDragOut, onAnySetStatus, onAttract, onAccuracy, onFoeAccuracy, onBasePower, onTryImmunity, onBeforeMove, onBeforeSwitchIn, onBeforeSwitchOut, onBeforeTurn, onBoost, onChargeMove, onCheckShow, onCopy, onDamage, onDeductPP, onDisableMove, onDragOut, onEat, onEatItem, onEnd, onFaint, onFlinch, onFoeAfterDamage, onFoeBasePower, onFoeBeforeMove, onFoeDisableMove, onFoeMaybeTrapPokemon, onFoeModifyDef, onFoeRedirectTarget, onFoeSwitchOut, onFoeTrapPokemon, onFoeTryMove, onHit, onHitField, onHitSide, onImmunity, onLockMove, onLockMoveTarget, onModifyAccuracy, onFoeModifyAccuracy, onModifyAtk, onModifyBoost, onModifyCritRatio, onModifyDamage, onModifyDef, onModifyMove, onModifyPriority, onModifySecondaries, onModifySpA, onModifySpD, onModifySpe, onModifyWeight, onMoveAborted, onMoveFail, onNegateImmunity, onOverrideAction, onPrepareHit, onPreStart, onPrimal, onRedirectTarget, onResidual, onRestart, onSetAbility, onSetStatus, onSourceAccuracy, onSourceBasePower, onSourceFaint, onSourceHit, onSourceModifyAccuracy, onSourceModifyAtk, onSourceModifyDamage, onSourceModifySecondaries, onSourceModifySpA, onSourceTryHeal, onSourceTryPrimaryHit, onStallMove, onStart, onSwitchIn, onSwitchOut, onTakeItem, onTerrain, onTrapPokemon, onTry, onTryAddVolatile, onTryEatItem, onTryHeal, onTryHit, onTryHitField, onTryHitSide, onTryMove, onTryPrimaryHit, onType, onUpdate, onUseMoveMessage, onWeather, onWeatherModifyDamage, onAfterSubDamage, onEffectiveness, onFoeDeductPP);
        /*EffectData*/
        this.id = id;
        this.name = name;
        this.num = num;
        this.affectsFainted = affectsFainted;
        this.desc = desc;
        this.duration = duration;
        this.drain = drain;
        this.effect = effect;
        this.effectType = effectType;
        this.isZ = isZ;

        this.onBasePowerPriority = onBasePowerPriority;

        this.onModifyAccuracyPriority = onModifyAccuracyPriority;
        this.onModifyAtkPriority = onModifyAtkPriority;
        this.onModifyCritRatioPriority = onModifyCritRatioPriority;
        this.onModifyDefPriority = onModifyDefPriority;
        this.onModifyMovePriority = onModifyMovePriority;
        this.onModifyPriorityPriority = onModifyPriorityPriority;
        this.onModifySpAPriority = onModifySpAPriority;
        this.onModifySpDPriority = onModifySpDPriority;
        this.onModifyWeightPriority = onModifyWeightPriority;

        this.onResidualOrder = onResidualOrder;
        this.recoil = recoil;
        this.secondaries = secondaries;
        this.self = self;
        this.shortDesc = shortDesc;

        /*Effect*/
        this.exists = exists;

        /*AbilityData*/
        this.effectType = effectType;
        this.rating = rating;
        this.isUnbreakable = isUnbreakable;
        this.suppressWeather = suppressWeather;

        /*NewlyAdded*/
        this.target = null;
    }
コード例 #10
0
    public void Init(Battle battle, PokemonCharacter source, ActiveMoveData activeData, Pokemon.TargetLocation targetLocation)
    {
        this.battle = battle;
        this.battle.AddNewMove(this);
        targetScript = GetComponent <TargetableElement>();
        targetScript.sourceElement = this;
        this.source         = source;
        this.activeData     = activeData;
        this.targetLocation = targetLocation;

        PrepareDamageData();
        OnCreatedMove();
    }
コード例 #11
0
    /*
     * if some targets
     *  damage = tryhitmove
     *  if damage stuff moveResult = true
     *  if(has selfboost && moveresult) moveHit
     *
     *
     */

    void MoveSuccessAfterEffects(TargetableElement target)
    {
        if (source.pokemonData.hp <= 0)
        {
            source.pokemonData.Faint(source, activeData.moveData);
        }

        if (!activeData.negateSecondary && !(activeData.hasSheerForce && source.pokemonData.HasAbilityActive(new string[] { "sheerforce" })))
        {
            BattleElement targetSource = (target == null) ? null : target.sourceElement;
            battle.SingleEvent("AfterMoveSecondarySelf", activeData.moveData, null, source.targetScript, targetSource, activeData.moveData);
            battle.RunEvent("AfterMoveSecondarySelf", source.targetScript, targetSource, activeData.moveData);
        }
    }
コード例 #12
0
    public bool Boost(Globals.BoostsTable boost, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
    {
        bool success = false;

        if (this.currentEvent != null)
        {
            if (target == null)
            {
                target = this.currentEvent.target;
            }
            if (source == null)
            {
                source = this.currentEvent.source;
            }
            if (effect == null)
            {
                effect = this.effectInEvent;
            }
        }

        if (target == null || !(target.sourceElement is PokemonCharacter) || ((PokemonCharacter)target.sourceElement).pokemonData.hp <= 0)
        {
            return(false);
        }
        if (!((PokemonCharacter)target.sourceElement).pokemonData.isActive)
        {
            return(false);
        }
        //if (this.gen > 5 && !target.side.foe.pokemonLeft) return false;
        RelayVar relayVar = new RelayVar(boosts: boost);

        boost = RunEvent("Boost", target, source, effect, relayVar).boosts;
        string[] boostedNames = boost.GetBoostedNames();
        foreach (string boostName in boostedNames)
        {
            int boostBy = ((PokemonCharacter)target.sourceElement).pokemonData.BoostBy(boostName, boost.GetBoostValue(boostName));

            if (boostBy != 0)
            {
                success  = true;
                relayVar = new RelayVar(integerValue: boostBy);
                RunEvent("AfterEachBoost", target, source, effect, relayVar);
            }
        }
        relayVar = new RelayVar(boosts: boost);
        RunEvent("AfterBoost", target, source, effect, relayVar);

        return(success);
    }
コード例 #13
0
    void TreatSecondaries(TargetableElement target, Globals.SecondaryEffect secondary, bool isSelf)
    {
        bool hitResult = false;

        if (target.sourceElement is PokemonCharacter)
        {
            int     didSomething = -1;
            Pokemon pokeTarget   = ((PokemonCharacter)target.sourceElement).pokemonData;

            //Secondary boosts
            if (secondary.boosts != null && !pokeTarget.fainted)
            {
                hitResult    = battle.Boost(secondary.boosts, target, source, secondary.SecondaryToMove());
                didSomething = (hitResult) ? 1 : 0;
            }

            //Secondary status
            if (secondary.status != "")
            {
                hitResult = pokeTarget.TrySetStatus(secondary.status, source, secondary.SecondaryToMove());
                if (!hitResult)
                {
                    return;
                }
                if (didSomething < 1)
                {
                    didSomething = (hitResult) ? 1 : 0;
                }
            }

            //Secondary volatile
            if (secondary.volatileStatus != "")
            {
                //FLONCH
                if (secondary.volatileStatus != "flinch")
                {
                    pokeTarget.StartActionCoolDown();
                }
                else
                {
                    hitResult = pokeTarget.AddVolatile(secondary.volatileStatus, source, secondary.SecondaryToMove());
                    if (didSomething < 1)
                    {
                        didSomething = (hitResult) ? 1 : 0;
                    }
                }
            }
        }
    }
コード例 #14
0
    public int Heal(int damage, TargetableElement target, BattleElement source, EffectData effect)
    {
        if (this.currentEvent != null)
        {
            if (target == null)
            {
                target = this.currentEvent.target;
            }
            if (source == null)
            {
                source = this.currentEvent.source;
            }
            if (effect == null)
            {
                effect = this.effectInEvent;
            }
        }
        if (damage < 1)
        {
            damage = 1;
        }
        RelayVar relayVar = new RelayVar(integerValue: damage);

        relayVar = RunEvent("TryHeal", target, source, effect, relayVar);
        damage   = relayVar.integerValue;
        if (relayVar.getEndEvent())
        {
            return(0);
        }
        if (!(target.sourceElement is PokemonCharacter))
        {
            return(0);
        }
        Pokemon pokeData = ((PokemonCharacter)target.sourceElement).pokemonData;

        if (pokeData.hp <= 0 || !pokeData.isActive || pokeData.hp >= pokeData.maxhp)
        {
            return(0);
        }

        int finalDamage = pokeData.Heal(damage);

        relayVar = new RelayVar(integerValue: finalDamage);

        RunEvent("Heal", target, source, effect, relayVar);
        return(finalDamage);
    }
コード例 #15
0
    public Battle(Stage stage, Team[] teams)
    {
        this.teams             = teams;
        this.stage             = stage;
        this.currentEvent      = null;
        this.effectInEvent     = null;
        this.effectDataInEvent = null;
        this.targetInEvent     = null;
        this.activeMoves       = new List <ActiveMove>();

        //Generate all pokemon characters
        for (int i = 0; i < teams.Length; ++i)
        {
            teams[i].InitPokemons(this);
        }
        //Set active weather
        //Set active terrain
    }
コード例 #16
0
    protected int MoveHit(TargetableElement target, EffectData moveData = null, bool isSecondary = false, bool isSelf = false)
    {
        int damage = -1;

        if (moveData == null)
        {
            moveData = activeData.moveData;
        }

        /*
         * TryHitField (singleevent)
         * TryHitSide (singleevent)
         * TryHit (singleevent)
         * TryPrimaryHit (runevent)
         */

        if (target.sourceElement is PokemonCharacter)
        {
            int     didSomething = -1;
            Pokemon pokeTarget   = ((PokemonCharacter)target.sourceElement).pokemonData;
            damage = GetDamage(pokeTarget);

            /*
             * selfdestruct stuff
             */
            if (damage >= 0 && !pokeTarget.fainted)
            {
                if (activeData.moveData.noFaint && damage >= pokeTarget.hp)
                {
                    damage = pokeTarget.hp - 1;
                }
                damage = battle.Damage(damage, target, source, activeData.moveData);
                //Damage interrumped
                if (damage <= 0)
                {
                    return(-1);
                }
                didSomething = 1;
            }

            /*
             * boosts stuff
             * heal stuff
             * status stuff
             * forceStatus stuff
             * volatileStatus stuff
             * sideCondition stuff
             * weather stuff
             * terrain stuff
             * pseudoWeather stuff
             * forceSwitch stuff
             * selfSwitch stuff
             *
             * //HIT EVENTS
             * HitField (singleevent)
             * HitSide (singleevent)
             * Hit (singleevent)
             * Hit (runevent)
             * AfterHit (singleevent)
             */
            //if the move didnt do someting return false
            if (didSomething < 0)
            {
                didSomething = 1;
            }

            if (didSomething == 0 && moveData.self == null &&
                (moveData is MoveData) && ((MoveData)moveData).selfdestruct == "")
            {
                return(-1);
            }
        }


        //Move has self && !selfdropped
        //move has secondaries
        if (moveData.secondaries != null)
        {
            Globals.SecondaryEffect[] secondaries = new Globals.SecondaryEffect[moveData.secondaries.Length];
            for (int i = 0; i < secondaries.Length; ++i)
            {
                secondaries[i] = moveData.secondaries[i].DeepCopy();
            }

            Battle.RelayVar relayVar = new Battle.RelayVar(secondaries: secondaries);
            secondaries = battle.RunEvent("ModifySecondaries", target, source, activeData.moveData, relayVar).secondaries;

            foreach (Globals.SecondaryEffect secondary in secondaries)
            {
                int secondaryRoll = RandomScript.RandomBetween(0, 100);
                if (secondary.chance < 0 || secondaryRoll < secondary.chance)
                {
                    TreatSecondaries(target, secondary, isSelf);
                }
            }
        }
        //Dragout
        //SelfSwitch
        return(damage);
    }
コード例 #17
0
    public static Battle.RelayVar ConfusionOnBeforeMove(Battle battle, Battle.RelayVar relayVar, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
    {
        Pokemon poke = ((PokemonCharacter)target.sourceElement).pokemonData;

        //Discount time not here anymore

        if (!RandomScript.RandomChance(1, 3))
        {
            return(relayVar);
        }
        battle.Damage(battle.GetDamage(poke, poke, null, 40), poke.targetData, poke.myPokemon,
                      new MoveData(id: "confused",
                                   effectType: Globals.EffectTypes.Move,
                                   type: Globals.Type.Unknown));

        relayVar.EndEventHere();
        return(relayVar);
    }
コード例 #18
0
    public static Battle.RelayVar PsnOnResidual(Battle battle, Battle.RelayVar relayVar, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
    {
        Pokemon pokemon = ((PokemonCharacter)target.sourceElement).pokemonData;

        battle.Damage(pokemon.maxhp / 8);
        return(relayVar);
    }
コード例 #19
0
    //Called when hit a target
    public int TryMoveHit(TargetableElement target)
    {
        activeData.zBrokeProtect = false;
        bool hitResult = true;

        if (battle.SingleEvent("Try", activeData.moveData, null, source.targetScript, target.sourceElement, activeData.moveData).getEndEvent())
        {
            return(-1);
        }

        //Affecting directly to a side o to the field
        if (target.teamTarget != null || target.battleTarget != null)
        {
            if (target.battleTarget != null)
            {
                hitResult = !battle.RunEvent("TryHitField", target, source, activeData.moveData).getEndEvent();
            }
            else
            {
                hitResult = !battle.RunEvent("TryHitSide", target, source, activeData.moveData).getEndEvent();
            }

            if (!hitResult)
            {
                return(-1);
            }

            return(MoveHit(target));
        }

        //Immunity
        hitResult = !battle.RunEvent("TryImmunity", target, source, activeData.moveData).getEndEvent();
        if (!hitResult)
        {
            return(-1);
        }

        if (activeData.moveData.ignoreImmunity == "")
        {
            activeData.moveData.ignoreImmunity = (activeData.moveData.category == Globals.MoveCategory.Status) ? "All" : "";
        }

        //TryHit
        hitResult = !battle.RunEvent("TryHit", target, source, activeData.moveData).getEndEvent();
        if (!hitResult)
        {
            return(-1);
        }

        //Immunity
        if (((PokemonCharacter)target.sourceElement).pokemonData.HasImmunity(activeData.moveType) &&
            activeData.moveData.ignoreImmunity == "")
        {
            return(-1);
        }

        //Powder Immunity
        if (target.sourceElement is PokemonCharacter && (activeData.moveData.flags & Globals.MoveFlags.Powder) != 0 &&
            target != source.targetScript && TypeChart.HasImmunity("powder", ((PokemonCharacter)target.sourceElement).pokemonData.types))
        {
            return(-1);
        }

        //Prankster Immunity
        if (activeData.pranksterBoosted && target.sourceElement is PokemonCharacter && source.pokemonData.HasAbilityActive(new string[] { "prankster" }) &&
            ((PokemonCharacter)target.sourceElement).pokemonData.team != source.pokemonData.team &&
            TypeChart.HasImmunity("prankster", ((PokemonCharacter)target.sourceElement).pokemonData.types)
            )
        {
            return(-1);
        }

        //Now it surely hits!!!

        //Breaks protect
        if (activeData.moveData.breaksProtect)
        {
            //Remove ShieldVolatiles
            //Remove ShieldConditions
        }

        //StealsBoosts
        if (activeData.moveData.stealsBoosts && target.sourceElement is PokemonCharacter)
        {
            Globals.BoostsTable boosts = ((PokemonCharacter)target.sourceElement).pokemonData.boosts.ShallowCopy();
            boosts.ClearNegatives();
            if (boosts.HasPositiveBoosts())
            {
                battle.Boost(boosts, source.targetScript, source);
                ((PokemonCharacter)target.sourceElement).pokemonData.SetBoosts(boosts);
            }
        }

        //If MultiHit (here?)

        //Else
        int damage = MoveHit(target);

        activeData.totalDamage += damage;

        //set to target gotAttacked
        if ((target.sourceElement is PokemonCharacter) && source.pokemonData != ((PokemonCharacter)target.sourceElement).pokemonData)
        {
            ((PokemonCharacter)target.sourceElement).pokemonData.GotAttacked(activeData.moveId, damage, source);
        }

        //return if no damage
        if (damage < 0)
        {
            return(damage);
        }

        //eachevent update
        battle.EventForActives("Update");

        //Secondary events
        if ((target.sourceElement is PokemonCharacter) && !activeData.negateSecondary && !(activeData.hasSheerForce /*&& source.pokemonData.HasAbilityActive(new string[] { "sheerforce" })*/))
        {
            battle.SingleEvent("AfterMoveSecondary", activeData.moveData, null, target, source, activeData.moveData);
            battle.RunEvent("AfterMoveSecondary", target, source, activeData.moveData);
        }

        return(damage);
    }
コード例 #20
0
    //OnModifySpa
    public static Battle.RelayVar OvergrowOnModifySpA(Battle battle, Battle.RelayVar relayVar, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
    {
        MoveData move     = (MoveData)effect;
        Pokemon  attacker = ((PokemonCharacter)target.sourceElement).pokemonData;

        if (move.type == Globals.Type.Grass && attacker.hp <= attacker.maxhp / 3)
        {
            Debug.Log("Overgrow boost Spa");
            // this.chainModify(1.5); //TODO
        }
        return(relayVar);
    }
コード例 #21
0
 public void ImpactedWith(TargetableElement te, GameObject proj)
 {
     Debug.Log(am.TryMoveHit(te));
     projectiles.Remove(proj);
     Destroy(proj);
 }
コード例 #22
0
 //OnModifyAtk
 public static Battle.RelayVar HustleOnModifyAtk(Battle battle, Battle.RelayVar relayVar, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
 {
     //battle.modify(relayVar.integerValue, 1.5);
     return(relayVar);
 }
コード例 #23
0
 public static Battle.RelayVar TestOnModifyAtk(Battle battle, Battle.RelayVar relayVar, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
 {
     relayVar.integerValue = 10;
     return(relayVar);
 }
コード例 #24
0
    //OnTakeItem
    public static Battle.RelayVar MegaStoneOnTakeItem(Battle battle, Battle.RelayVar relayVar, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
    {
        ItemData item    = (ItemData)relayVar.effectValue;
        Pokemon  pSource = ((PokemonCharacter)source).pokemonData;

        if (item.megaEvolves == pSource.baseTemplate.baseSpecies)
        {
            relayVar.EndEventHere();
        }
        else
        {
            relayVar.booleanValue = true;
        }

        return(relayVar);
    }
コード例 #25
0
 //OnStart
 public static Battle.RelayVar ConfusionOnStart(Battle battle, Battle.RelayVar relayVar, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
 {
     battle.effectDataInEvent.time = RandomScript.RandomBetween(2, 6);
     return(relayVar);
 }
コード例 #26
0
 public static Battle.RelayVar FlinchOnBeforeMove(Battle battle, Battle.RelayVar relayVar, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
 {
     Debug.Log("You are not sup-POSED to be hia?");
     if (battle.RunEvent("Flinch", target).getEndEvent())
     {
         return(relayVar);
     }
     relayVar.EndEventHere();
     return(relayVar);
 }
コード例 #27
0
 //OnBeforeMove
 public static Battle.RelayVar ParOnBeforeMove(Battle battle, Battle.RelayVar relayVar, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
 {
     if (RandomScript.RandomChance(1, 4))
     {
         relayVar.EndEventHere();
     }
     return(relayVar);
 }
コード例 #28
0
 public static Battle.RelayVar EndEventOnTakeItem(Battle battle, Battle.RelayVar relayVar, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
 {
     relayVar.EndEventHere();
     return(relayVar);
 }
コード例 #29
0
 public static Battle.RelayVar TestingStuff(Battle battle, Battle.RelayVar relayVar, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
 {
     relayVar.integerValue++;
     return(relayVar);
 }
コード例 #30
0
    //onBasePower
    public static Battle.RelayVar TechnicianOnBasePower(Battle battle, Battle.RelayVar relayVar, TargetableElement target = null, BattleElement source = null, EffectData effect = null)
    {
        int basePower = relayVar.integerValue;

        if (basePower <= 60)
        {
            relayVar.integerValue = Mathf.FloorToInt(basePower * 1.5f);
        }
        return(relayVar);
    }