public Agent.PropertyChange UseMedicines(Consumables consumables)
        {
            if (consumables.attachedSkillInfos.Length > 0)
            {
                for (int i = 0; i < consumables.attachedSkillInfos.Length; i++)
                {
                    SkillInfo        si = consumables.attachedSkillInfos [i];
                    ConsumablesSkill cs = SkillGenerator.Instance.GenerateConsumablesSkill(consumables, si, consumablesSkillsContainer);
                    cs.AffectAgents(battleAgentCtr, null);
                }
                RemoveItem(consumables, 1);
            }

            Debug.LogFormat("{0}使用了{1}", agentName, consumables.itemName);

            return(ResetBattleAgentProperties(false));
        }
Exemple #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 ();
			}
		}
Exemple #3
0
		public void RemoveAttachedSkill<T>(T skill){
			
			if (typeof(T) == typeof(TriggeredSkill) && triggeredSkills.Contains(skill as TriggeredSkill)) {
				TriggeredSkill trigSkill = skill as TriggeredSkill;

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

				if (triggeredSkills.Contains (trigSkill)) {
					triggeredSkills.Remove (trigSkill);
				}

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

				self.UpdateStatusPlane ();

			} else if (typeof(T) == typeof(ConsumablesSkill) && consumablesSkills.Contains(skill as ConsumablesSkill)) {

				ConsumablesSkill consSkill = skill as ConsumablesSkill;

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

				if (consumablesSkills.Contains (consSkill)) {
					consumablesSkills.Remove (consSkill);
				}

				if (self.agent.allStatus.Contains (consSkill.statusName)) {
					self.agent.allStatus.Remove (consSkill.statusName);
				}

				self.UpdateStatusPlane ();
			}
		}
//		private Transform mAllSkillsContainer;
//		public Transform allSkillsContainer{
//			get{
//				if (mAllSkillsContainer == null) {
//					mAllSkillsContainer = TransformManager.FindOrCreateTransform ("AllSkillsContainer");
//				}
//				return mAllSkillsContainer;
//			}
//		}

//		public Transform allSkillsContainer;

        public ConsumablesSkill GenerateConsumablesSkill(Item item, SkillInfo skillInfo, Transform skillContainer)
        {
            ConsumablesSkill newSkill = null;

            if (skillInfo.excuteOnce)
            {
                ConsumablesSkill cs = GameManager.Instance.gameDataCenter.allSkills.Find(delegate(Skill obj) {
                    return(obj.name == "ConsumablesPropertyChangeOnce");
                }) as ConsumablesSkill;
                newSkill = GameObject.Instantiate(cs.gameObject, skillContainer).GetComponent <ConsumablesSkill> ();
                newSkill.gameObject.name = string.Format("{0}-{1}", item.itemName, "ConsumablesPropertyChangeOnce");
            }
            else
            {
                ConsumablesSkill cs = GameManager.Instance.gameDataCenter.allSkills.Find(delegate(Skill obj) {
                    return(obj.name == "ConsumablesPropertyChangeDurative");
                }) as ConsumablesSkill;
                newSkill = GameObject.Instantiate(cs.gameObject, skillContainer).GetComponent <ConsumablesSkill> ();
                newSkill.gameObject.name = string.Format("{0}-{1}", item.itemName, "ConsumablesPropertyChangeDurative");
            }

            string propertyName = "";

            switch (skillInfo.skillType)
            {
            case MySkillType.MaxHealth:
                newSkill.propertyType = PropertyType.MaxHealth;
                propertyName          = "MaxHealth";
                break;

            case MySkillType.Health:
                newSkill.propertyType = PropertyType.Health;
                propertyName          = "Health";
                break;

            case MySkillType.Mana:
                newSkill.propertyType = PropertyType.Mana;
                propertyName          = "Mana";
                break;

            case MySkillType.Attack:
                newSkill.propertyType = PropertyType.Attack;
                propertyName          = "Attack";
                break;

            case MySkillType.AttackSpeed:
                newSkill.propertyType = PropertyType.AttackSpeed;
                propertyName          = "AttackSpeed";
                break;

            case MySkillType.Armor:
                newSkill.propertyType = PropertyType.Armor;
                propertyName          = "Armor";
                break;

            case MySkillType.MagicResist:
                newSkill.propertyType = PropertyType.MagicResist;
                propertyName          = "MagicResist";
                break;

            case MySkillType.Dodge:
                newSkill.propertyType = PropertyType.Dodge;
                propertyName          = "Dodge";
                break;

            case MySkillType.Crit:
                newSkill.propertyType = PropertyType.Crit;
                propertyName          = "Crit";
                break;

            case MySkillType.Hit:
                newSkill.propertyType = PropertyType.Hit;
                propertyName          = "Hit";
                break;

            case MySkillType.WholeProperty:
                newSkill.propertyType = PropertyType.WholeProperty;
                propertyName          = "WholeProperty";
                break;
            }

            newSkill.gameObject.name = newSkill.gameObject.name + "-" + propertyName;

            newSkill.selfEffectAnimName  = skillInfo.selfEffectAnimName;
            newSkill.enemyEffectAnimName = skillInfo.enemyEffectAnimName;
            newSkill.statusName          = skillInfo.statusName;
            newSkill.skillSourceValue    = skillInfo.skillSourceValue;
            newSkill.duration            = skillInfo.duration;
            newSkill.canOverlay          = skillInfo.canOverlay;

            return(newSkill);
        }