Esempio n. 1
0
//		public int maxHealthChangeFromTriggeredSkill;
//		public int hitChangeFromTriggeredSkill;
//		public int manaChangeFromTriggeredSkill;
//		public int attackChangeFromTriggeredSkill;
//		public int attackSpeedChangeFromTriggeredSkill;
//		public int armorChangeFromTriggeredSkill;
//		public int magicResistChangeFromTriggeredSkill;
//		public int dodgeChangeFromTriggeredSkill;
//		public int critChangeFromTriggeredSkill;

//		public float maxHealthChangeScalerFromTriggeredSkill;
//		public float hitChangeScalerFromTriggeredSkill;
//		public float manaChangeScalerFromTriggeredSkill;
//		public float attackChangeScalerFromTriggeredSkill;
//		public float attackSpeedChangeScalerFromTriggeredSkill;
//		public float armorChangeScalerFromTriggeredSkill;
//		public float magicResistChangeScalerFromTriggeredSkill;
//		public float dodgeChangeScalerFromTriggeredSkill;
//		public float critChangeScalerFromTriggeredSkill;
//		public float physicalHurtScalerChangeFromTriggeredSkill;
//		public float magicalHurtScalerChangeFromTriggeredSkill;
//		public float critHurtScalerChangeFromTriggeredSkill;

		/// <summary>
		/// 如果是即时性的属性变化,需要使用这个方法
		/// </summary>
		/// <param name="target">Target.</param>
		/// <param name="propertyType">Property type.</param>
		/// <param name="change">Change.</param>
		public void InstantPropertyChange(BattleAgentController target,PropertyType propertyType,float change,bool fromTriggeredSkill = true){

//			string instantChange = string.Format ("即时性属性变化: 角色名称:{0},类型:{1},变化:{2}",
//				target.agent.agentName, propertyType,change);
//
//			Debug.Log (instantChange);

			if (change == 0) {
				return;
			}

			int healthChange = 0;
			string tintText = "";

			if (propertyType == PropertyType.Health) {
				if (change > 0 && change < 1) {
					healthChange = (int)(target.agent.maxHealth * change);
					tintText = string.Format ("<color=green>{0}</color>", healthChange.ToString ());
					target.AddFightTextToQueue (tintText, SpecialAttackResult.Gain);
				} else if (change >= 1) {
					healthChange = (int)change;
					tintText = string.Format ("<color=green>{0}</color>", healthChange.ToString ());
					target.AddFightTextToQueue (tintText, SpecialAttackResult.Gain);
				} else if (change < 0 && change > -1) {
					healthChange = (int)(target.agent.maxHealth * change);
					tintText = string.Format ("<color=red>{0}</color>", (-healthChange).ToString ());
					target.AddFightTextToQueue (tintText, SpecialAttackResult.None);
				} else {
					healthChange = (int)change;
					tintText = string.Format ("<color=red>{0}</color>", (-healthChange).ToString ());
					target.AddFightTextToQueue (tintText, SpecialAttackResult.None);
				}

				target.agent.health += healthChange;
				target.propertyCalculator.health = target.agent.health;

				if (target.agent.health <= 0) {
					target.AgentDie ();
				}

			} else {

				AgentPropertyChange (propertyType, change, fromTriggeredSkill);
		
				target.agent.ResetPropertiesWithPropertyCalculator (this);

			}
	
			target.UpdateStatusPlane ();
		}
Esempio n. 2
0
		public void SkillTriggered<T>(T skill){

			if (typeof(T) == typeof(TriggeredSkill)) {
				
				TriggeredSkill trigSkill = skill as TriggeredSkill;

				if (trigSkill.statusName == "") {
					return;
				}

				if(!triggeredSkills.Contains(trigSkill)){
					triggeredSkills.Add (trigSkill);
				}

				if (!self.agent.allStatus.Contains (trigSkill.statusName)) {
					self.agent.allStatus.Add (trigSkill.statusName);
				}

				string statusTint = "";
				if (MyTool.propertyChangeStrings.TryGetValue (trigSkill.statusName,out statusTint)) {
					self.AddFightTextToQueue (statusTint,SpecialAttackResult.Status);
				}

				self.UpdateStatusPlane ();

			} else if (typeof(T) == typeof(ConsumablesSkill)) {
				ConsumablesSkill consSkill = skill as ConsumablesSkill;
				if (consSkill.statusName == "") {
					return;
				}
				if (!consumablesSkills.Contains (consSkill)) {
					consumablesSkills.Add (consSkill);
				}
				if (!self.agent.allStatus.Contains (consSkill.statusName)) {
					self.agent.allStatus.Add (consSkill.statusName);
				}
				self.UpdateStatusPlane ();
			}
		}
Esempio n. 3
0
        public int skillSourceValue;        //魔法伤害值


        protected override void ExcuteNoneTriggeredSkillLogic(BattleAgentController self, BattleAgentController enemy)
        {
            // 执行攻击触发事件回调
            for (int i = 0; i < self.attackTriggerExcutors.Count; i++)
            {
                TriggeredSkillExcutor excutor = self.attackTriggerExcutors[i];
                switch (excutor.triggerSource)
                {
                case SkillEffectTarget.Self:
                    excutor.triggeredCallback(self, enemy);
                    break;

                case SkillEffectTarget.Enemy:
                    excutor.triggeredCallback(enemy, self);
                    break;
                }
            }

            // 敌方执行被攻击触发事件回调
            for (int i = 0; i < enemy.beAttackedTriggerExcutors.Count; i++)
            {
                TriggeredSkillExcutor excutor = enemy.beAttackedTriggerExcutors[i];
                switch (excutor.triggerSource)
                {
                case SkillEffectTarget.Self:
                    excutor.triggeredCallback(enemy, self);
                    break;

                case SkillEffectTarget.Enemy:
                    excutor.triggeredCallback(self, enemy);
                    break;
                }
            }

            //计算对方闪避率(敌方的基础闪避率 - 己方的闪避修正)
            int   enemyDodge       = enemy.propertyCalculator.dodge;
            float dodgeProbability = dodgeSeed * enemyDodge / (1 + dodgeSeed * enemyDodge) - self.propertyCalculator.dodgeFixScaler;

            //判断对方是否闪避成功
            if (isEffective(dodgeProbability))
            {
                enemy.propertyCalculator.specialAttackResult = SpecialAttackResult.Miss;
                enemy.AddFightTextToQueue(string.Empty, SpecialAttackResult.Miss);
                return;
            }

            enemy.PlayShakeAnim();

            //原始魔法伤害值
            self.propertyCalculator.magicalHurtToEnemy += skillSourceValue;

            SetEffectAnims(self, enemy);

            // 执行己方攻击命中的回调
            for (int i = 0; i < self.hitTriggerExcutors.Count; i++)
            {
                TriggeredSkillExcutor excutor = self.hitTriggerExcutors[i];
                switch (excutor.triggerSource)
                {
                case SkillEffectTarget.Self:
                    excutor.triggeredCallback(self, enemy);
                    break;

                case SkillEffectTarget.Enemy:
                    excutor.triggeredCallback(enemy, self);
                    break;
                }
            }


            // 执行敌方被击中的回调
            for (int i = 0; i < enemy.beHitTriggerExcutors.Count; i++)
            {
                TriggeredSkillExcutor excutor = enemy.beHitTriggerExcutors[i];
                switch (excutor.triggerSource)
                {
                case SkillEffectTarget.Self:
                    excutor.triggeredCallback(enemy, self);
                    break;

                case SkillEffectTarget.Enemy:
                    excutor.triggeredCallback(self, enemy);
                    break;
                }
            }


            self.propertyCalculator.CalculateAgentHealth();
            enemy.propertyCalculator.CalculateAgentHealth();


            self.UpdateFightStatus();
            enemy.UpdateFightStatus();

            self.UpdateStatusPlane();
            enemy.UpdateStatusPlane();

            self.propertyCalculator.ResetAllHurt();
            enemy.propertyCalculator.ResetAllHurt();
        }