Esempio n. 1
0
        protected override void ExcuteConsumablesSkillLogic(BattleAgentController self)
        {
            if (selfEffectAnimName != string.Empty)
            {
                self.SetEffectAnim(selfEffectAnimName, null);
            }

            // 如果没有状态名称,则默认不是触发状态,直接执行技能
            if (statusName == "")
            {
                Excute(self);
                return;
            }

            List <TriggeredSkill> sameStatusSkills = self.propertyCalculator.GetTriggeredSkillsWithSameStatus(statusName);

            // 如果技能效果不可叠加,则被影响人身上原有的同种状态技能效果全部取消,并从战斗结算器中移除这些技能
            if (!canOverlay)
            {
                for (int i = 0; i < sameStatusSkills.Count; i++)
                {
                    TriggeredSkill ts = sameStatusSkills [i];
                    ts.CancelSkillEffect(ts != this);
                }
            }

            // 执行技能
            Excute(self);
        }
        protected override void ExcuteTriggeredSkillLogic(TriggerInfo triggerInfo, BattleAgentController self, BattleAgentController enemy)
        {
            // 判断被动是否生效
            if (!isEffective(triggeredProbability))
            {
                return;
            }

            SetEffectAnims(triggerInfo, self, enemy);

            // 如果没有状态名称,则默认不是触发状态,直接执行技能
            if (statusName == "")
            {
                Excute();
                return;
            }

            List <TriggeredSkill> sameStatusSkills = affectedAgent.propertyCalculator.GetTriggeredSkillsWithSameStatus(statusName);

            // 如果技能效果不可叠加,则被影响人身上原有的同种状态技能效果全部取消,并从战斗结算器中移除这些技能
            if (!canOverlay)
            {
                for (int i = 0; i < sameStatusSkills.Count; i++)
                {
                    TriggeredSkill ts = sameStatusSkills [i];
                    ts.CancelSkillEffect(ts == this);
                }
            }

            Excute();
        }
Esempio n. 3
0
        protected override void ExcuteTriggeredSkillLogic(TriggerInfo triggerInfo, BattleAgentController self, BattleAgentController enemy)
        {
            if (isEffective(triggeredProbability))
            {
                List <TriggeredSkill> fizzySkills = enemy.propertyCalculator.GetTriggeredSkillsWithSameStatus(statusName);

                affectedAgent = GetAffectedBattleAgent(triggerInfo, self, enemy);

                if (fizzySkills.Count > 0)
                {
                    for (int i = 0; i < fizzySkills.Count; i++)
                    {
                        TriggeredSkill ts = fizzySkills [i];
                        ts.CancelSkillEffect(ts != this);
                    }
                }
                else
                {
                    affectedAgent.propertyCalculator.SkillTriggered <TriggeredSkill> (this);
                }


                affectedAgent.PlayRoleAnim("stun", 0, null);
                affectedAgent.isAttackActionFinish = false;

                fizzyCoroutine = StartCoroutine("FizzyForDuration", affectedAgent);

                SetEffectAnims(triggerInfo, self, enemy);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 角色卸下装备
        /// </summary>
        /// <param name="equipment">Equipment.</param>
        /// <param name="equipmentIndexInPanel">Equipment index in panel.</param>
        public PropertyChange UnloadEquipment(Equipment equipment, int equipmentIndexInPanel, int indexInBag = -1)
        {
            SoundManager.Instance.PlayAudioClip("UI/sfx_UI_Equipment");

            equipment.equiped = false;

            Debug.LogFormat("卸下装备{0}/{1}", equipmentIndexInPanel, allEquipedEquipments.Length);

            if (equipment.itemId < 0)
            {
                return(new PropertyChange());
            }

            if (indexInBag == -1)
            {
                allItemsInBag.Add(equipment);
            }
            else
            {
                allItemsInBag.Insert(indexInBag, equipment);
            }

            for (int i = 0; i < equipment.attachedSkills.Count; i++)
            {
                TriggeredSkill attachedSkill = equipment.attachedSkills [i];
                attachedTriggeredSkills.Remove(attachedSkill);
                if (!(battleAgentCtr as BattlePlayerController).isInFight)
                {
                    equipment.attachedSkills.Remove(attachedSkill);
                    Destroy(attachedSkill.gameObject);
                    i--;
                }
            }

            Equipment emptyEquipment = new Equipment();

            allEquipedEquipments [equipmentIndexInPanel] = emptyEquipment;

            PropertyChange pc = ResetBattleAgentProperties(false);

            Transform exploreManager = TransformManager.FindTransform("ExploreManager");

            if (exploreManager != null)
            {
                ExploreManager manager = exploreManager.GetComponent <ExploreManager> ();
                manager.UpdatePlayerPropertyCalculator();
                manager.UpdateTriggeredCallBacks();
                manager.UpdatePlayerStatusPlane();
            }


            return(pc);
        }
Esempio n. 5
0
        /// <summary>
        /// 角色穿上装备
        /// </summary>
        /// <param name="equipment">Equipment.</param>
        /// <param name="equipmentIndexInPanel">Equipment index in panel.</param>
        public PropertyChange EquipEquipment(Equipment equipment, int equipmentIndexInPanel)
        {
            SoundManager.Instance.PlayAudioClip("UI/sfx_UI_Equipment");

            equipment.equiped = true;

            Debug.LogFormat("穿上装备{0}", equipmentIndexInPanel);

            allEquipedEquipments [equipmentIndexInPanel] = equipment;

//			equipmentDragControl.item = equipment;

            if (equipment.attachedSkills.Count == 0)
            {
                for (int i = 0; i < equipment.attachedSkillInfos.Length; i++)
                {
                    TriggeredSkill attachedSkill = SkillGenerator.Instance.GenerateTriggeredSkill(equipment, equipment.attachedSkillInfos [i], triggeredSkillsContainer);
                    equipment.attachedSkills.Add(attachedSkill);
                    attachedTriggeredSkills.Add(attachedSkill);
                    attachedSkill.transform.SetParent(triggeredSkillsContainer);
                }
            }
            else
            {
                for (int i = 0; i < equipment.attachedSkills.Count; i++)
                {
                    TriggeredSkill attachedSkill = equipment.attachedSkills [i];
                    attachedTriggeredSkills.Add(attachedSkill);
                }
            }

            allItemsInBag.Remove(equipment);

            PropertyChange pc = ResetBattleAgentProperties(false);

            Transform exploreManager = TransformManager.FindTransform("ExploreManager");

            if (exploreManager != null)
            {
                ExploreManager manager = exploreManager.GetComponent <ExploreManager> ();
                manager.UpdatePlayerPropertyCalculator();
                manager.UpdateTriggeredCallBacks();
                manager.UpdatePlayerStatusPlane();
            }

            return(pc);
        }
Esempio n. 6
0
 public void DestroyEquipmentInBagAttachedSkills()
 {
     for (int j = 0; j < allEquipmentsInBag.Count; j++)
     {
         Equipment equipment = allEquipmentsInBag [j];
         if (!equipment.equiped && equipment.attachedSkills.Count > 0)
         {
             for (int i = 0; i < equipment.attachedSkills.Count; i++)
             {
                 TriggeredSkill attachedSkill = equipment.attachedSkills [i];
                 equipment.attachedSkills.RemoveAt(i);
                 Destroy(attachedSkill.gameObject);
                 i--;
             }
         }
     }
 }
Esempio n. 7
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. 8
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 ();
			}
		}
Esempio n. 9
0
        public void SetUpPlayerWithPlayerData(PlayerData playerData)
        {
            if (playerData == null)
            {
                return;
            }

            this.agentName = playerData.agentName;
//			this.agentIconName = playerData.agentIconName;
            this.agentLevel = playerData.agentLevel;
//			this.isActive = false;

            this.originalMaxHealth   = playerData.originalMaxHealth;
            this.originalMana        = playerData.originalMana;
            this.originalAttack      = playerData.originalAttack;
            this.originalAttackSpeed = playerData.originalAttackSpeed;
            this.originalArmor       = playerData.originalArmor;
            this.originalMagicResist = playerData.originalManaResist;
            this.originalCrit        = playerData.originalCrit;
            this.originalDodge       = playerData.originalDodge;
            this.originalHealth      = playerData.originalHealth;
            this.originalMana        = playerData.originalMana;

            this.originalPhysicalHurtScaler = 1.0f;
            this.originalMagicalHurtScaler  = 1.0f;
            this.originalCritHurtScaler     = 1.5f;


            this.charactersCount = playerData.charactersCount;

            this.allEquipmentsInBag      = playerData.allEquipmentsInBag;
            this.allEquipedEquipments    = playerData.allEquipedEquipments;
            this.allConsumablesInBag     = playerData.allConsumablesInBag;
            this.allItemsInBag           = playerData.allItemsInBag;
            this.allUnlockScrollsInBag   = playerData.allUnlockScrollsInBag;
            this.allCraftingRecipesInBag = playerData.allCraftRecipesInBag;


            this.maxUnlockLevelIndex = playerData.maxUnlockLevelIndex;
//			this.currentLevelIndex = playerData.currentLevelIndex;

            this.totalCoins = playerData.totalCoins;
            this.experience = playerData.experience;

            this.attachedTriggeredSkills.Clear();
            this.attachedConsumablesSkills.Clear();
            this.allStatus.Clear();

            ResetBattleAgentProperties(true);


            allItemsInBag = new List <Item> ();

            for (int i = 0; i < allEquipmentsInBag.Count; i++)
            {
                if (!allEquipmentsInBag [i].equiped)
                {
                    allItemsInBag.Add(allEquipmentsInBag [i]);
                }
            }

            for (int i = 0; i < allConsumablesInBag.Count; i++)
            {
                allItemsInBag.Add(allConsumablesInBag[i]);
            }

            for (int i = 0; i < allUnlockScrollsInBag.Count; i++)
            {
                if (!allUnlockScrollsInBag [i].unlocked)
                {
                    allItemsInBag.Add(allUnlockScrollsInBag [i]);
                }
            }

            for (int i = 0; i < allCraftingRecipesInBag.Count; i++)
            {
                allItemsInBag.Add(allCraftingRecipesInBag[i]);
            }

            for (int i = 0; i < triggeredSkillsContainer.childCount; i++)
            {
                Destroy(triggeredSkillsContainer.GetChild(i).gameObject);
            }

            for (int i = 0; i < allEquipedEquipments.Length; i++)
            {
                Equipment equipment = allEquipedEquipments [i];

                if (equipment.itemId > 0)
                {
                    for (int j = 0; j < equipment.attachedSkillInfos.Length; j++)
                    {
                        TriggeredSkill attachedSkill = SkillGenerator.Instance.GenerateTriggeredSkill(equipment, equipment.attachedSkillInfos [j], triggeredSkillsContainer);

                        equipment.attachedSkills.Add(attachedSkill);

                        Debug.LogFormat("{0}-{1}", equipment.itemName, attachedSkill.name);

                        attachedTriggeredSkills.Add(attachedSkill);
                    }
                }
            }
        }
 public TriggeredSkillExcutor(TriggeredSkill ts, SkillEffectTarget source, SkillCallBack callBack)
 {
     this.triggeredSkill    = ts;
     this.triggerSource     = source;
     this.triggeredCallback = callBack;
 }
        private TriggeredSkill GetPropertyOnceOrDurativeChangeSkill(Item item, SkillInfo skillInfo, Transform skillContainer)
        {
            TriggeredSkill skill = null;

            if (skillInfo.excuteOnce)
            {
                PropertyChangeOnce propertyChangeOnce = GameManager.Instance.gameDataCenter.allSkills.Find(delegate(Skill obj) {
                    return(obj.skillName == "PropertyChangeOnce");
                }) as PropertyChangeOnce;

                string propertyName = "";

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

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

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

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

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

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

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

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

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

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

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

                skill = GameObject.Instantiate(propertyChangeOnce.gameObject, skillContainer).GetComponent <TriggeredSkill> ();

                skill.gameObject.name = string.Format("{0}-{1}-{2}", item.itemName, "PropertyChangeOnce", propertyName);
            }
            else
            {
                PropertyChangeDurative durativeChange = GameManager.Instance.gameDataCenter.allSkills.Find(delegate(Skill obj) {
                    return(obj.skillName == "PropertyChangeDurative");
                }) as PropertyChangeDurative;

                string propertyName = "";

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

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

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

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

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

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

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

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

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

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

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

                skill = GameObject.Instantiate(durativeChange.gameObject, skillContainer).GetComponent <TriggeredSkill> ();

                skill.gameObject.name = string.Format("{0}-{1}-{2}", item.itemName, "PropertyChangeDurative", propertyName);
            }



            return(skill);
        }
        public TriggeredSkill GenerateTriggeredSkill(Item item, SkillInfo skillInfo, Transform skillContainer)
        {
            TriggeredSkill newSkill = null;

//			public float skillSourceValue;//技能数据输入源
//			public float duration;//状态持续事件

            switch (skillInfo.skillType)
            {
            case MySkillType.AttachMagicalHurt:

                TriggeredSkill attachMagicalHurt = GameManager.Instance.gameDataCenter.allSkills.Find(delegate(Skill obj) {
                    return(obj.skillName == "AttachMagicalHurt");
                }) as TriggeredSkill;

                newSkill = GameObject.Instantiate(attachMagicalHurt.gameObject, skillContainer).GetComponent <TriggeredSkill> ();

                newSkill.gameObject.name = string.Format("{0}-{1}", item.itemName, "AttachMagicalHurt");

                break;

            case MySkillType.HealthAbsorb:

                TriggeredSkill healthAbsorb = GameManager.Instance.gameDataCenter.allSkills.Find(delegate(Skill obj) {
                    return(obj.skillName == "HealthAbsorb");
                }) as TriggeredSkill;

                newSkill = GameObject.Instantiate(healthAbsorb.gameObject, skillContainer).GetComponent <TriggeredSkill> ();

                newSkill.gameObject.name = string.Format("{0}-{1}", item.itemName, "HealthAbsorb");

                break;

            case MySkillType.Fizzy:

                TriggeredSkill fizzy = GameManager.Instance.gameDataCenter.allSkills.Find(delegate(Skill obj) {
                    return(obj.skillName == "Fizzy");
                }) as TriggeredSkill;

                newSkill = GameObject.Instantiate(fizzy.gameObject, skillContainer).GetComponent <TriggeredSkill> ();

                newSkill.gameObject.name = string.Format("{0}-{1}", item.itemName, "Fizzy");

                break;

            case MySkillType.ReflectHurt:
                TriggeredSkill reflectHurt = GameManager.Instance.gameDataCenter.allSkills.Find(delegate(Skill obj) {
                    return(obj.skillName == "ReflectHurt");
                }) as TriggeredSkill;

                newSkill = GameObject.Instantiate(reflectHurt.gameObject, skillContainer).GetComponent <TriggeredSkill> ();

                newSkill.gameObject.name = string.Format("{0}-{1}", item.itemName, "ReflectHurt");

                break;

            case MySkillType.Health:
            case MySkillType.Mana:
            case MySkillType.Attack:
            case MySkillType.AttackSpeed:
            case MySkillType.Armor:
            case MySkillType.MagicResist:
            case MySkillType.Dodge:
            case MySkillType.Crit:
            case MySkillType.Hit:
            case MySkillType.WholeProperty:
                newSkill = GetPropertyOnceOrDurativeChangeSkill(item, skillInfo, skillContainer);
                break;

            case MySkillType.None:
                Debug.LogError(string.Format("物品{0}缺少技能类型信息,无法生成技能", item.itemName));
                break;
            }


            switch (skillInfo.triggeredCondition)
            {
            case TriggeredCondition.BeforeFight:
                newSkill.beforeFightTriggerInfo.triggerSource = skillInfo.triggerSource;
                newSkill.beforeFightTriggerInfo.triggerTarget = skillInfo.triggerTarget;
                newSkill.beforeFightTriggerInfo.triggered     = true;
                break;

            case TriggeredCondition.Attack:
                newSkill.attackTriggerInfo.triggerSource = skillInfo.triggerSource;
                newSkill.attackTriggerInfo.triggerTarget = skillInfo.triggerTarget;
                newSkill.attackTriggerInfo.triggered     = true;
                break;

            case TriggeredCondition.Hit:
                newSkill.hitTriggerInfo.triggerSource = skillInfo.triggerSource;
                newSkill.hitTriggerInfo.triggerTarget = skillInfo.triggerTarget;
                newSkill.hitTriggerInfo.triggered     = true;
                break;

            case TriggeredCondition.BeAttacked:
                newSkill.beAttackedTriggerInfo.triggerSource = skillInfo.triggerSource;
                newSkill.beAttackedTriggerInfo.triggerTarget = skillInfo.triggerTarget;
                newSkill.beAttackedTriggerInfo.triggered     = true;
                break;

            case TriggeredCondition.BeHit:
                newSkill.beHitTriggerInfo.triggerSource = skillInfo.triggerSource;
                newSkill.beHitTriggerInfo.triggerTarget = skillInfo.triggerTarget;
                newSkill.beHitTriggerInfo.triggered     = true;
                break;

            case TriggeredCondition.None:

                break;
            }



            newSkill.hurtType = skillInfo.hurtType;

            newSkill.selfEffectAnimName  = skillInfo.selfEffectAnimName;
            newSkill.enemyEffectAnimName = skillInfo.enemyEffectAnimName;


            newSkill.statusName = skillInfo.statusName;

            newSkill.triggeredProbability = skillInfo.triggeredProbability;
            newSkill.skillSourceValue     = skillInfo.skillSourceValue;
            newSkill.duration             = skillInfo.duration;
            newSkill.canOverlay           = skillInfo.canOverlay;



            return(newSkill);
        }