Example #1
0
        /// <summary>
        /// 特技导致武将状态改变
        /// </summary>
        /// <param name="skill">Skill.</param>
        private void AddAidToCharacter(App.Model.Master.MSkillEffect mSkillEffect, App.Model.MCharacter[] targetCharacters)
        {
            List <int> aids  = mSkillEffect.strategys.ToList();
            int        index = 0;
            List <App.Model.Master.MStrategy> strategys = new List <App.Model.Master.MStrategy>();

            while (index++ < mSkillEffect.count)
            {
                int i = Random.Range(0, aids.Count - 1);
                App.Model.Master.MStrategy strategy = StrategyCacher.Instance.Get(aids[i]);
                aids.RemoveAt(i);
                strategys.Add(strategy);
            }
            foreach (App.Model.Master.MStrategy strategy in strategys)
            {
                foreach (App.Model.MCharacter target in targetCharacters)
                {
                    //特效
                    if (strategy.effect_type == App.Model.Master.StrategyEffectType.aid)
                    {
                        //this.mCharacter.Target.AddAid(strategy);
                        VTile vTile = this.cBattlefield.mapSearch.GetTile(target.CoordinateX, target.CoordinateY);
                        this.cBattlefield.CreateEffect(strategy.effect, vTile.transform);
                    }
                    else if (strategy.effect_type == App.Model.Master.StrategyEffectType.status)
                    {
                        //this.mCharacter.Target.AddStatus(strategy);
                        VTile vTile = this.cBattlefield.mapSearch.GetTile(target.CoordinateX, target.CoordinateY);
                        this.cBattlefield.CreateEffect(strategy.effect, vTile.transform);
                    }
                }
            }
            cBattlefield.StartCoroutine(AddAidToCharacterComplete(strategys, targetCharacters));
        }
Example #2
0
        /// <summary>
        /// 特技导致武将状态改变
        /// </summary>
        /// <param name="skill">Skill.</param>
        private void AddAidToCharacter(App.Model.Master.MSkillEffect mSkillEffect, MCharacter[] targetCharacters)
        {
            List <int> aids  = mSkillEffect.strategys.ToList();
            int        index = 0;
            List <App.Model.Master.MStrategy> strategys = new List <App.Model.Master.MStrategy>();

            while (index++ < mSkillEffect.count)
            {
                int i = UnityEngine.Random.Range(0, aids.Count - 1);
                App.Model.Master.MStrategy strategy = StrategyCacher.Instance.Get(aids[i]);
                aids.RemoveAt(i);
                strategys.Add(strategy);
            }
            foreach (App.Model.Master.MStrategy strategy in strategys)
            {
                foreach (MCharacter target in targetCharacters)
                {
                    //特效
                    if (strategy.effect_type == StrategyEffectType.aid)
                    {
                        VTile vTile = Global.mapSearch.GetTile(target.coordinate);
                        //cBattle.CreateEffect(strategy.effect, vTile.transform);
                    }
                    else if (strategy.effect_type == StrategyEffectType.status)
                    {
                        VTile vTile = Global.mapSearch.GetTile(target.coordinate);
                        //cBattle.CreateEffect(strategy.effect, vTile.transform);
                    }
                }
            }
            AppManager.CurrentScene.StartCoroutine(AddAidToCharacterComplete(strategys, targetCharacters));
        }
Example #3
0
 public void RemoveStatus(App.Model.Master.MStrategy status)
 {
     this.ViewModel.Status.Value.Remove(status);
     if (this.ViewModel.Status.OnValueChanged != null)
     {
         this.ViewModel.Status.OnValueChanged(null, this.ViewModel.Status.Value);
     }
 }
Example #4
0
 public void RemoveAid(App.Model.Master.MStrategy aid)
 {
     this.ViewModel.Aids.Value.Remove(aid);
     if (this.ViewModel.Aids.OnValueChanged != null)
     {
         this.ViewModel.Aids.OnValueChanged(null, this.ViewModel.Aids.Value);
     }
 }
Example #5
0
        public override void UpdateView(App.Model.MBase model)
        {
            App.Model.Master.MStrategy mStrategy = model as App.Model.Master.MStrategy;
            string iconName = string.Format("{0}_{1}", mStrategy.aid_type.ToString(), mStrategy.hert > 0 ? "up" : "down");

            //Debug.LogError("VStatusIcon iconName = " + iconName);
            foreach (GameObject icon in icons)
            {
                //Debug.LogError(icon.name+" == "+iconName + ", " + (icon.name == iconName));
                icon.SetActive(icon.name == iconName);
            }
        }
Example #6
0
        public void OnDamage(VCharacter vCharacter)
        {
            MCharacter        mCharacter  = this.GetCharacterModel(vCharacter);
            MCharacter        targetModel = vCharacter.ViewModel.Target.Value;
            VCharacter        target      = this.GetCharacterView(targetModel);
            List <VCharacter> characters  = this.charactersManager.GetTargetCharacters(vCharacter, target, vCharacter.ViewModel.CurrentSkill.Value.Master);

            App.View.VTile tile = mapSearch.GetTile(mCharacter.CoordinateX, mCharacter.CoordinateY);
            foreach (VCharacter child in characters)
            {
                MCharacter childModel = this.GetCharacterModel(child);
                bool       hit        = calculateManager.AttackHitrate(mCharacter, childModel);
                if (!hit)
                {
                    child.SendMessage(CharacterEvent.OnBlock.ToString());
                    continue;
                }
                App.Model.Battle.MDamageParam arg = new App.Model.Battle.MDamageParam(-this.calculateManager.Hert(mCharacter, childModel, tile));
                child.SendMessage(CharacterEvent.OnDamage.ToString(), arg);
                if (child.ViewModel.CharacterId.Value != targetModel.CharacterId)
                {
                    continue;
                }
                if (mCharacter.CurrentSkill.Master.effect.enemy.time == App.Model.Master.SkillEffectBegin.enemy_hert)
                {
                    if (mCharacter.CurrentSkill.Master.effect.special == App.Model.Master.SkillEffectSpecial.vampire)
                    {
                        App.Model.Master.MStrategy strategy = App.Util.Cacher.StrategyCacher.Instance.Get(mCharacter.CurrentSkill.Master.effect.enemy.strategys[0]);
                        VCharacter currentCharacter         = this.GetCharacterView(mCharacter);

                        int addHp = -UnityEngine.Mathf.FloorToInt(arg.value * strategy.hert * 0.01f);
                        App.Model.Battle.MDamageParam arg2 = new App.Model.Battle.MDamageParam(addHp);
                        currentCharacter.SendMessage(CharacterEvent.OnHealWithoutAction.ToString(), arg2);
                    }
                }
                else if (mCharacter.CurrentSkill.Master.effect.enemy.time == App.Model.Master.SkillEffectBegin.attack_end)
                {
                    if (mCharacter.CurrentSkill.Master.effect.special == App.Model.Master.SkillEffectSpecial.status)
                    {
                        int specialValue = mCharacter.CurrentSkill.Master.effect.special_value;
                        if (specialValue > 0 && UnityEngine.Random.Range(0, 50) > specialValue)
                        {
                            continue;
                        }
                        childModel.attackEndEffects.Add(mCharacter.CurrentSkill.Master.effect.enemy);
                    }
                }
            }
        }