public override void UpdateInPlayerAround(BattlePokemonData pokemon)
 {
     if (0 == --count[pokemon.ID])
     {
         LoseState(pokemon);
     }
     else
     {
         DebugHelper.LogFormat("{0}还需要{1}回合解除大闹一番状态", pokemon.Ename, count[pokemon.ID]);
     }
 }
 protected override void ChangeCatachCorrection(BattlePokemonData pokemon)
 {
     if (PokemonType.水 == pokemon.MainPokemonType || PokemonType.水 == pokemon.SecondPokemonType ||
         PokemonType.虫 == pokemon.MainPokemonType || PokemonType.虫 == pokemon.SecondPokemonType)
     {
         CatachCorrection = 3;
     }
     else
     {
         CatachCorrection = 1;
     }
 }
        public override void OnLeave(BattlePokemonData self)
        {
            bool fire = false;

            if (can.TryGetValue(self.ID, out fire))
            {
                if (fire)
                {
                    can.Remove(self.ID);
                    DebugHelper.LogFormat("{0}下场,引火状态取消", self.Ename);
                }
            }
        }
示例#4
0
 public bool Can(BattlePokemonData pokemon)
 {
     if (PokemonType.钢 == BattleController.Instance.PlayerCurPokemonData.MainPokemonType ||
         PokemonType.钢 == BattleController.Instance.PlayerCurPokemonData.SecondPokemonType)
     {
         if (PokemonType.幽灵 != BattleController.Instance.PlayerCurPokemonData.MainPokemonType &&
             PokemonType.幽灵 != BattleController.Instance.PlayerCurPokemonData.SecondPokemonType)
         {
             return(true);
         }
     }
     return(false);
 }
        public override void LoseState(BattlePokemonData pokemon)
        {
            DebugHelper.LogFormat("{0}麻痹状态解除,速度恢复了", pokemon.Ename);

            if (AbilityType.飞毛腿 != pokemon.ShowAbility)
            {
                //pokemon.increase.speed /= 1.5f;
            }
            else
            {
                pokemon.increase.speed *= 2;
            }
        }
 public override void OnAttack(
     BattlePokemonData self, Skill skill, BattlePokemonData defencePokemon,
     ref float power, ref float Critical)
 {
     if (self.curHealth < self.Health / 3)
     {
         if (PokemonType.草 == skill.att)
         {
             DebugHelper.LogFormat("因为茂盛特性{0}的技能{1}的威力威力提高为原来的1.5倍", self.Ename, skill.sname);
             power *= 1.5f;
         }
     }
 }
        protected override void ChangeCatachCorrection(BattlePokemonData pokemon)
        {
            int around = BattleController.Instance.BattleAroundCount;

            if (10 <= around)
            {
                CatachCorrection = 4;
            }
            else
            {
                CatachCorrection = 1 + 0.3f * around;
            }
        }
示例#8
0
 public override void OnBeAttacked(ref bool hit, BattlePokemonData self, Skill skill, BattlePokemonData attackPokemon)
 {
     if (hit)
     {
         if (SkillType.物理 == skill.type)
         {
             StatModifiers stat = self.StatModifiers;
             stat.PhysicDefence -= 1;
             stat.Speed         += 2;
             DebugHelper.LogFormat("{0}具有碎裂铠甲特性,受到物理攻击时,防御降低1级,速度提升2级", self.Ename);
         }
     }
 }
        public override void OnLeave(BattlePokemonData self)
        {
            int h = self.Health / 3;

            h = Math.Min(h, self.Health - self.curHealth);
            self.curHealth += h;
            DebugHelper.Log(
                new StringBuilder(40)
                .AppendFormat("{0}具有再生力特性,交换下场时,恢复", self.Ename)
                .Append(h)
                .Append("生命")
                .ToString());
        }
    public override void Refresh()
    {
        pokemon = BattlePokemonData.Context
                  [trainerData.pokemons[ChosePokemonIndex].GetInstanceID()];

        basestats = pokemon.basestats;
        Show_Icons();
        Show_Power();
        Show_Skills();
        Show_Race();
        Show_prop();
        Resources.UnloadUnusedAssets();
    }
 public override void OnBeAttacked(
     BattlePokemonData self, Skill skill, BattlePokemonData attackPokemon,
     ref bool IsIngnore)
 {
     if (PokemonType.电 == skill.att)
     {
         IsIngnore = true;
         attackPokemon.SetAbnormalStateEnum(AbnormalStateEnum.Paralysis);
         StatModifiers stat = self.StatModifiers;
         stat.EnergyPower  += 1;
         self.StatModifiers = stat;
         DebugHelper.LogFormat("{0}具有避雷针特性,电属性技能对{0}无效,被电属性招式击中时,特攻提升1级", self.Ename);
     }
 }
        protected override void ChangeCatachCorrection(BattlePokemonData pokemon)
        {
            if (1 == BattleController.Instance.BattleAroundCount)
            {
                CatachCorrection = 5;
                DebugHelper.Log("你是第一回合使用先机球,捕捉概率提高了400%");
            }

            else
            {
                CatachCorrection = 1;
                DebugHelper.Log("你不是第一回合使用先机球,使用先机球和普通精灵球没有区别");
            }
        }
    private void Show_UIBattle_Skills()
    {
        BattlePokemonData pokemonData =
            BattleController.Instance.PlayerCurPokemonData;

        if (null == pokemonData)
        {
            Hide();
            return;
        }
        if (PrePokemonData != pokemonData)
        {
            if (null != PrePokemonData)
            {
                var Preentity = PrePokemonData.entity;
                var Preaction = Preentity.pokemonDataChangeEvent.Event;
                Preaction -= Refresh;
                Preentity.ReplacePokemonDataChangeEvent(Preaction);
            }

            PrePokemonData = pokemonData;

            var entity = pokemonData.entity;
            var action = entity.pokemonDataChangeEvent.Event;
            action += Refresh;
            entity.ReplacePokemonDataChangeEvent(action);
        }


        List <int> skillIDs = pokemonData.skills;
        List <int> skillPPs = pokemonData.skillPPs;
        int        i        = 0;

        for (; i < skillIDs.Count; ++i)
        {
            id = skillIDs[i];
            Skill skill = ResourceController.Instance.allSkillDic[id];
            SkillPokemonTypeText_list[i].text = skill.att.ToString();
            SkillNameText_list[i].text        = skill.sname;
            StringBuilder sb = new StringBuilder(20);
            sb.AppendFormat("{0}a{1}", skillPPs[i], skill.FullPP);
            SkillPPText_list[i].text = sb.ToString();
            ShowSkill(skill1rect_list[i]);
        }
        while (i < 4)
        {
            HideSkill(skill1rect_list[i]);
            ++i;
        }
    }
示例#14
0
        protected override void ChangeCatachCorrection(BattlePokemonData pokemon)
        {
            if (pokemon.race.speed >= 100)
            {
                CatachCorrection = 4;
                DebugHelper.LogFormat("野生精灵{0}速度种族为{1},速度球发挥了奇效,捕捉概率提高了300%", pokemon.Ename, pokemon.race.speed);
            }

            else
            {
                CatachCorrection = 1;
                DebugHelper.LogFormat("野生精灵{0}速度种族为{1},小于100,使用速度球和普通精灵球没有区别", pokemon.Ename, pokemon.race.speed);
            }
        }
        public override void Init(BattlePokemonData pokemon)
        {
            AbnormalState.Abnormalstates[pokemon.Abnormal].LoseState(pokemon);
            pokemon.Abnormal = AbnormalStateEnum.Sleeping;
            DebugHelper.Log(
                new StringBuilder(40)
                .AppendFormat("{0}睡着了,还有", pokemon.Ename)
                .Append(SleepTimeDict[pokemon.ID])
                .Append("回合醒来")
                .ToString());


            SleepTimeDict[pokemon.ID] = RandomService.game.Int(1, 4);
        }
        public override bool CanAction(BattlePokemonData pokemon)
        {
            bool flag = 0 == SleepTimeDict[pokemon.ID];

            if (!flag)
            {
                DebugHelper.Log(
                    new StringBuilder(40)
                    .AppendFormat("{0}还在睡觉不能行动,还有", pokemon.Ename)
                    .Append(SleepTimeDict[pokemon.ID])
                    .Append("回合醒来")
                    .ToString());
            }
            return(flag);
        }
 public override void UpdateInPlayerAround(BattlePokemonData pokemon)
 {
     if (ifCanScape[pokemon.ID] > 0)
     {
         ifCanScape[pokemon.ID]--;
     }
     else if (0 == ifCanScape[pokemon.ID])
     {
         LoseState(pokemon);
     }
     else if (-1 == ifCanScape[pokemon.ID])
     {
         return;
     }
 }
    public static Pokemon BuildPokemon(EncounterPokemon encounter)
    {
        int     PokemonID = PokemonFactory.GetPokemonFromEncounterPokemonScriptableObject(encounter);
        Pokemon pokemon   = PokemonFactory.BuildPokemon(PokemonID);
        //考虑特性
        Pokemon           FirstPokemon = Contexts.sharedInstance.game.playerData.scriptableObject.pokemons[0];
        BattlePokemonData pokemonData  = BattlePokemonData.Context[FirstPokemon.GetInstanceID()];

        if (AbilityManager.AbilityImpacts.ContainsKey(pokemonData.ShowAbility))
        {
            AbilityManager.AbilityImpacts[pokemonData.ShowAbility]
            .OnEncounterPokemon(pokemonData, pokemon);
        }
        return(pokemon);
    }
        public override bool CanAction(BattlePokemonData pokemon)
        {
            bool isfalg = RandomService.game.Float(0, 5) < 1;

            if (isfalg)
            {
                DebugHelper.LogFormat("{0}冰冻状态解除", pokemon.Ename);
                pokemon.SetAbnormalStateEnum(AbnormalStateEnum.Normal);
            }
            else
            {
                DebugHelper.LogFormat("{0}冰冻了无法行动", pokemon.Ename);
            }
            return(isfalg);
        }
        public override void BattleStartEffect(BattlePokemonData pokemon, ref bool canEnd)
        {
            canEnd = true;
            float scale = recoverValue / 100f;

            int h = (int)(pokemon.Health * scale);

            h = Math.Min(h, pokemon.Health - pokemon.curHealth);
            DebugHelper.LogFormat("{0}的生命恢复了{1}", pokemon.Ename, h);
            pokemon.curHealth += h;
            if (pokemon.curHealth > pokemon.Health)
            {
                pokemon.curHealth = pokemon.Health;
            }
        }
示例#21
0
    private void ExchangePokemon(BattlePokemonData newCallPokemon)
    {
        DebugHelper.LogFormat("我方玩家将精灵{0}替换成了{1}", PlayerCurPokemonData.Ename, newCallPokemon.Ename);

        //回收精灵GameObject
        PlayerCurPokemonData.transform.gameObject.SetActive(false);
        ObjectPoolController.PokemonObjectsPool[PlayerCurPokemonData.race.raceid] =
            PlayerCurPokemonData.transform.gameObject;

        //如果剧毒就重置计数
        if (AbnormalStateEnum.BadlyPoison == PlayerCurPokemonData.Abnormal)
        {
            BadlyPoisonState.count[PlayerCurPokemonData.ID] = 1;
        }

        //能力阶级重置
        PlayerCurPokemonData.StatModifiers = new StatModifiers();

        //考虑特性
        if (AbilityManager.AbilityImpacts.ContainsKey(PlayerCurPokemonData.ShowAbility))
        {
            AbilityManager.AbilityImpacts[PlayerCurPokemonData.ShowAbility]
            .OnLeave(PlayerCurPokemonData);
        }

        PlayerCurPokemonData = newCallPokemon;
        PlayChooseSkillID    = -1;

        //召唤新的精灵
        GameObject playerPokemon = PokemonFactory.InitPokemon(PlayerCurPokemonData.race.raceid);

        playerPokemon.transform.position = PlayerPokemonTransform.position;
        playerPokemon.transform.parent   = PlayerPokemonTransform;
        PokemonFactory.PokemonBallEffect(playerPokemon.transform.position);
        PlayerCurPokemonData.transform = playerPokemon.transform;

        //控制精灵和训练家朝向
        playerPokemon.transform.LookAt(EnemyCurPokemonData.transform);

        //考虑特性
        if (AbilityManager.AbilityImpacts.ContainsKey(PlayerCurPokemonData.ShowAbility))
        {
            AbilityManager.AbilityImpacts[PlayerCurPokemonData.ShowAbility]
            .OnBeCalled(PlayerCurPokemonData);
        }

        TTUIPage.ShowPage <UIBattle_PokemonInfos>();
    }
        public override void OnAttack(BattlePokemonData self, Skill skill, BattlePokemonData defencePokemon, ref float power, ref float Critical)
        {
            bool fire = false;

            if (PokemonType.火 == skill.att)
            {
                if (can.TryGetValue(self.ID, out fire))
                {
                    if (fire)
                    {
                        power *= 1.5f;
                        DebugHelper.LogFormat("{0}已处于引火状态,使用火属性攻击招式时,攻击和特攻×1.5", self.Ename);
                    }
                }
            }
        }
        protected override void ChangeCatachCorrection(BattlePokemonData pokemon)
        {
            int around = BattleController.Instance.BattleAroundCount;

            if (10 <= around)
            {
                CatachCorrection = 4;
            }

            else
            {
                CatachCorrection = 1 + 0.3f * around;
            }

            DebugHelper.LogFormat("现在是第{0}回合,计时球概率为普通精灵球的{1}倍", around, CatachCorrection);
        }
 public override void BattleStartEffect(BattlePokemonData pokemon, ref bool canEnd)
 {
     if (!wait.ContainsKey(pokemon.ID))
     {
         NeedReplaceSKill.context[pokemon.ID] = skillID;
         pokemon.AddChangeState(ChangeStateEnumForPokemon.WaitNextAround);
         canEnd           = true;
         wait[pokemon.ID] = 1;
     }
     else if (wait.ContainsKey(pokemon.ID) &&
              NeedReplaceSKill.context.ContainsKey(pokemon.ID))
     {
         NeedReplaceSKill.context.Remove(pokemon.ID);
         wait.Remove(pokemon.ID);
     }
 }
 public override void UpdateInPlayerAround(BattlePokemonData pokemon)
 {
     if (0 == --count[pokemon.ID])
     {
         LoseState(pokemon);
     }
     else
     {
         DebugHelper.Log(
             new StringBuilder(40)
             .AppendFormat("{0}还需要", pokemon.Ename)
             .Append(count[pokemon.ID])
             .Append("回合解除大闹一番状态")
             .ToString());
     }
 }
示例#26
0
    private void ExchangePokemon(Notification <int> notific)
    {
        if (PlayerCurPokemonData.ChangeStateForPokemonEnums.Contains(ChangeStateEnumForPokemon.CanNotEscape))
        {
            //不允许逃脱
            DebugHelper.LogFormat("当前精灵{0}处于逃脱状态,不允许替换精灵", PlayerCurPokemonData.Ename);

            return;
        }
        TTUIPage.ShowPage <UIBattle_Skills>();

        BattlePokemonData newCallPokemon = playPokemons[notific.param];

        ExchangePokemon(newCallPokemon);
        UpdateBattleState();
    }
        public override void UpdateInPlayerAround(BattlePokemonData pokemon)
        {
            int h = pokemon.Health / 16;

            h = Math.Min(h, pokemon.curHealth);
            //考虑特性
            if (AbilityManager.AbilityImpacts.ContainsKey(pokemon.ShowAbility))
            {
                AbilityManager.AbilityImpacts[pokemon.ShowAbility]
                .OnAbnomalCauseDamage
                (
                    pokemon, ref h
                );
            }
            DebugHelper.LogFormat("{0}因为烧伤受到了{1}伤害", pokemon.Ename, h);
            pokemon.curHealth -= h;
        }
        public override void OnBeAttacked(ref bool hit, BattlePokemonData self, Skill skill, BattlePokemonData attackPokemon)
        {
            int skillID = attackPokemon.LastUseSkillID;

            if (hit && -1 != skillID)
            {
                if (RandomService.game.Int(0, 100) < 30)
                {
                    string skillName = ResourceController.Instance.allSkillDic[skillID].sname;

                    attackPokemon.AddChangeState(ChangeStateEnumForPokemon.DisableSkill);

                    DebugHelper.LogFormat("{1}触发了{0}的诅咒之躯特性,{2}被封印了",
                                          attackPokemon.Ename, self.Ename, skillName);
                }
            }
        }
        public override void HitEffect(BattlePokemonData pokemon)
        {
            StatModifiers stat = pokemon.StatModifiers;

            if (isAdd)
            {
                stat.AvoidanceRate += ChangeNum;
                DebugHelper.Log(Log(pokemon.Ename, "回避率上升", ChangeNum));
            }

            else
            {
                stat.AvoidanceRate -= ChangeNum;
                DebugHelper.Log(Log(pokemon.Ename, "回避率下降", ChangeNum));
            }
            pokemon.StatModifiers = stat;
        }
        public override void HitEffect(BattlePokemonData pokemon)
        {
            StatModifiers stat = pokemon.StatModifiers;

            if (isAdd)
            {
                stat.PhysicPower += ChangeNum;
                DebugHelper.Log(Log(pokemon.Ename, "物攻上升", ChangeNum));
            }

            else
            {
                stat.PhysicPower -= ChangeNum;
                DebugHelper.Log(Log(pokemon.Ename, "物攻下降", ChangeNum));
            }
            pokemon.StatModifiers = stat;
        }