コード例 #1
0
        public void PerformAOEComplete(BaseCharacter source, GameObject target, float outputShare, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(abilityEffectName + ".AOEEffect.PerformAbilityEffect(): abilityEffectInput.healthAmount: " + (abilityEffectInput == null ? "null" : abilityEffectInput.healthAmount.ToString()) + "; outputShare: " + outputShare);
            AbilityEffectOutput modifiedOutput = GetSharedOutput(outputShare, abilityEffectInput);

            PerformAbilityComplete(source, target, modifiedOutput);
        }
コード例 #2
0
        public virtual void PerformAOEComplete(BaseCharacter source, GameObject target, float outputShare, AbilityEffectOutput abilityEffectInput, float castDelay)
        {
            //Debug.Log(abilityEffectName + ".AOEEffect.PerformAbilityEffect(): abilityEffectInput.healthAmount: " + (abilityEffectInput == null ? "null" : abilityEffectInput.healthAmount.ToString()) + "; outputShare: " + outputShare);
            AbilityEffectOutput modifiedOutput = GetSharedOutput(outputShare, abilityEffectInput);

            source.StartCoroutine(WaitForCompleteDelay(source, target, modifiedOutput, castDelay));
        }
コード例 #3
0
        /// <summary>
        /// Does the actual work of hitting the target with an ability
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public override void PerformAbilityHit(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(abilityEffectName + ".HealEffect.PerformAbilityEffect(" + source.name + ", " + (target == null ? "null" : target.name) + ") effect: " + abilityEffectName);
            int healthFinalAmount = 0;

            if (healthBaseAmount > 0)
            {
                healthFinalAmount = (int)CalculateAbilityAmount(healthBaseAmount, source, target.GetComponent <CharacterUnit>());
            }
            healthFinalAmount += (int)(abilityEffectInput.healthAmount * inputMultiplier);
            AbilityEffectOutput abilityEffectOutput = new AbilityEffectOutput();

            abilityEffectOutput.healthAmount = healthFinalAmount;
            if (healthFinalAmount > 0)
            {
                target.GetComponent <CharacterUnit>().MyCharacter.MyCharacterStats.RecoverHealth(healthFinalAmount, source);
            }
            int manaFinalAmount = 0;

            if (manaBaseAmount > 0)
            {
                manaFinalAmount = (int)CalculateAbilityAmount(manaBaseAmount, source, target.GetComponent <CharacterUnit>());
            }
            manaFinalAmount += (int)(abilityEffectInput.manaAmount * inputMultiplier);
            abilityEffectOutput.manaAmount = manaFinalAmount;
            if (manaFinalAmount > 0)
            {
                target.GetComponent <CharacterUnit>().MyCharacter.MyCharacterStats.RecoverMana(manaFinalAmount, source);
            }
            abilityEffectOutput.prefabLocation = abilityEffectInput.prefabLocation;
            base.PerformAbilityHit(source, target, abilityEffectOutput);
        }
コード例 #4
0
        private AbilityEffectOutput GetSharedOutput(float outputShare, AbilityEffectOutput abilityEffectInput)
        {
            AbilityEffectOutput modifiedOutput = new AbilityEffectOutput();

            modifiedOutput.healthAmount   = (int)(abilityEffectInput.healthAmount * outputShare);
            modifiedOutput.manaAmount     = (int)(abilityEffectInput.manaAmount * outputShare);
            modifiedOutput.prefabLocation = abilityEffectInput.prefabLocation;
            return(modifiedOutput);
        }
コード例 #5
0
        /// <summary>
        /// Does the actual work of hitting the target with an ability
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public override void PerformAbilityHit(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(resourceName + ".ResurrectEffect.PerformAbilityEffect(" + source.name + ", " + (target == null ? "null" : target.name) + ") effect: " + resourceName);
            AbilityEffectOutput abilityEffectOutput = new AbilityEffectOutput();

            abilityEffectOutput.prefabLocation = abilityEffectInput.prefabLocation;
            ResurrectTarget(target);
            base.PerformAbilityHit(source, target, abilityEffectOutput);
        }
コード例 #6
0
        public void CheckPetSpawn(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(MyName + ".PetEffect.CheckPetSpawn()");
            List <CharacterUnit> unitsToRemove = new List <CharacterUnit>();

            foreach (CharacterUnit characterUnit in petUnits)
            {
                //if (characterUnit != null) {
                if (characterUnit.MyCharacter.MyCharacterStats.IsAlive == false)
                {
                    //Debug.Log(MyName + ".PetEffect.CheckPetSpawn(): ADDING DEAD PET TO REMOVE LIST");
                    unitsToRemove.Add(characterUnit);
                }
                //}
            }
            foreach (CharacterUnit characterUnit in unitsToRemove)
            {
                //Debug.Log(MyName + ".PetEffect.CheckPetSpawn(): REMOVING DEAD PET");
                petUnits.Remove(characterUnit);
            }
            if (petUnits.Count == 0)
            {
                //Debug.Log(MyName + ".PetEffect.CheckPetSpawn(): SPAWNING PETS");
                // spawn pet
                List <AbilityEffect> castList = new List <AbilityEffect>();
                foreach (AbilityEffect petEffect in realPetEffectList)
                {
                    //if (source.MyCharacterAbilityManager.HasAbility(petAbilityName)) {
                    if (SystemResourceManager.MatchResource(petEffect.MyName, MyName))
                    {
                        Debug.LogError(MyName + ".PerformAbilityEffects(): circular reference detected.  Tried to cast self.  CHECK INSPECTOR AND FIX ABILITY EFFECT CONFIGURATION!!!");
                    }
                    else
                    {
                        //Debug.Log(MyName + ".PetEffect.CheckPetSpawn(): adding to cast list");
                        castList.Add(petEffect);
                    }
                    //}
                }
                if (castList.Count > 0)
                {
                    //Debug.Log(MyName + ".PetEffect.CheckPetSpawn(): castlist.count: " + castList.Count);
                    Dictionary <PrefabProfile, GameObject> rawObjectList = PerformAbilityEffects(source, target, abilityEffectInput, castList);
                    foreach (KeyValuePair <PrefabProfile, GameObject> tmpObject in rawObjectList)
                    {
                        //Debug.Log(MyName + ".PetEffect.CheckPetSpawn(): LOOPING THROUGH RAW OBJECT LIST ");
                        CharacterUnit _characterUnit = tmpObject.Value.GetComponent <CharacterUnit>();
                        if (_characterUnit != null)
                        {
                            //Debug.Log(MyName + ".PetEffect.CheckPetSpawn(): ADDING PET TO UNIT LIST");
                            petUnits.Add(_characterUnit);
                        }
                    }
                }
            }
        }
コード例 #7
0
 public void Initialize(float velocity, BaseCharacter source, GameObject target, Vector3 positionOffset, AbilityEffectOutput abilityEffectInput)
 {
     //Debug.Log("ProjectileScript.Initialize(" + velocity + ", " + source.name + ", " + (target == null ? "null" : target.name) + ", " + positionOffset + ")");
     this.source             = source;
     this.velocity           = velocity;
     this.target             = target;
     this.positionOffset     = positionOffset;
     this.abilityEffectInput = abilityEffectInput;
     initialized             = true;
 }
コード例 #8
0
 /// <summary>
 /// Does the actual work of hitting the target with an ability
 /// </summary>
 /// <param name="ability"></param>
 /// <param name="source"></param>
 /// <param name="target"></param>
 public override void Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
 {
     //Debug.Log(MyName + ".AOEEffect.Cast(" + (source == null ? "null" : source.name) + ", " + (target == null ? "null" : target.name) + ")");
     if (abilityEffectInput == null)
     {
         abilityEffectInput = new AbilityEffectOutput();
     }
     base.Cast(source, target, originalTarget, abilityEffectInput);
     TargetAOEHit(source, target, abilityEffectInput);
 }
コード例 #9
0
        private float TargetAOEComplete(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput)
        {
            List <GameObject> validTargets = GetValidTargets(source, target, abilityEffectInput, completeAbilityEffectList);

            foreach (GameObject validTarget in validTargets)
            {
                PerformAOEComplete(source, validTarget, 1f / validTargets.Count, abilityEffectInput);
            }
            return(validTargets.Count);
        }
コード例 #10
0
        /// <summary>
        /// Does the actual work of hitting the target with an ability
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public override void PerformAbilityHit(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(MyAbilityEffectName + ".AttackAbility.PerformAbilityEffect(" + source.name + ", " + target.name + ")");
            if (abilityEffectInput == null)
            {
                //Debug.Log("AttackEffect.PerformAbilityEffect() abilityEffectInput is null!");
            }
            if (source == null || target == null)
            {
                // something died or despawned mid cast
                return;
            }
            if (source.MyCharacterCombat.DidAttackMiss() == true)
            {
                //Debug.Log(MyName + ".AttackEffect.PerformAbilityHit(" + source.name + ", " + target.name + "): attack missed");
                source.MyCharacterCombat.ReceiveCombatMiss(target);
                return;
            }
            int             healthFinalAmount = 0;
            CombatMagnitude combatMagnitude   = CombatMagnitude.normal;

            if (useHealthAmount == true)
            {
                float healthTotalAmount = healthBaseAmount + (healthAmountPerLevel * source.MyCharacterStats.MyLevel);
                KeyValuePair <float, CombatMagnitude> abilityKeyValuePair = CalculateAbilityAmount(healthTotalAmount, source, target.GetComponent <CharacterUnit>(), abilityEffectInput);
                healthFinalAmount = (int)abilityKeyValuePair.Key;
                combatMagnitude   = abilityKeyValuePair.Value;
            }
            healthFinalAmount += (int)(abilityEffectInput.healthAmount * inputMultiplier);

            AbilityEffectOutput abilityEffectOutput = new AbilityEffectOutput();

            abilityEffectOutput.healthAmount = healthFinalAmount;
            if (healthFinalAmount > 0)
            {
                // this effect may not have any damage and only be here for spawning a prefab or making a sound
                target.GetComponent <CharacterUnit>().MyCharacter.MyCharacterCombat.TakeDamage(healthFinalAmount, source.MyCharacterUnit.transform.position, source, combatMagnitude, this, abilityEffectInput.refectDamage);
            }
            abilityEffectOutput.prefabLocation = abilityEffectInput.prefabLocation;

            // handle weapon on hit effects
            if (source.MyCharacterCombat != null && source.MyCharacterCombat.MyOnHitEffect != null && damageType == DamageType.physical && source.MyCharacterCombat.MyOnHitEffect.MyName != MyName)
            {
                List <AbilityEffect> onHitEffectList = new List <AbilityEffect>();
                onHitEffectList.Add(source.MyCharacterCombat.MyOnHitEffect);
                PerformAbilityEffects(source, target, abilityEffectOutput, onHitEffectList);
            }
            else
            {
                //Debug.Log(MyName + ".AttackEffect.PerformAbilityHit(" + (source == null ? "null" : source.name) + ", " + (target == null ? "null" : target.name) + "): no on hit effect set");
            }

            // handle regular effects
            base.PerformAbilityHit(source, target, abilityEffectOutput);
        }
コード例 #11
0
        private float TargetAOEHit(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(MyName + "AOEEffect.TargetAOEHit(" + (source == null ? "null" : source.name) + ", " + (target == null ? "null" : target.name) + ")");
            List <GameObject> validTargets = GetValidTargets(source, target, abilityEffectInput, hitAbilityEffectList);

            foreach (GameObject validTarget in validTargets)
            {
                PerformAOEHit(source, validTarget, 1f / validTargets.Count, abilityEffectInput);
            }
            return(validTargets.Count);
        }
コード例 #12
0
        public override void Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(MyName + ".InstantEffect.Cast()");
            if (abilityEffectInput == null)
            {
                abilityEffectInput = new AbilityEffectOutput();
            }
            base.Cast(source, target, originalTarget, abilityEffectInput);

            PerformAbilityHit(source, target, abilityEffectInput);
        }
コード例 #13
0
        /// <summary>
        /// Does the actual work of hitting the target with an ability
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public override Dictionary <PrefabProfile, GameObject> Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(MyName + ".AOEEffect.Cast(" + (source == null ? "null" : source.name) + ", " + (target == null ? "null" : target.name) + ")");
            if (abilityEffectInput == null)
            {
                abilityEffectInput = new AbilityEffectOutput();
            }
            Dictionary <PrefabProfile, GameObject> returnObjects = base.Cast(source, target, originalTarget, abilityEffectInput);

            TargetAOEHit(source, target, abilityEffectInput);
            return(returnObjects);
        }
コード例 #14
0
        public override Dictionary <PrefabProfile, GameObject> Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(MyName + ".InstantEffect.Cast()");
            if (abilityEffectInput == null)
            {
                abilityEffectInput = new AbilityEffectOutput();
            }
            Dictionary <PrefabProfile, GameObject> returnObjects = base.Cast(source, target, originalTarget, abilityEffectInput);

            PerformAbilityHit(source, target, abilityEffectInput);
            return(returnObjects);
        }
コード例 #15
0
        private IEnumerator WaitForHitDelay(BaseCharacter source, GameObject target, AbilityEffectOutput modifiedOutput, float castDelay)
        {
            //Debug.Log(MyName + ".AOEEffect.WaitForHitDelay(" + source.MyName + ", " + (target == null ? "null" : target.name) + ")");
            float accumulatedTime = 0f;

            while (accumulatedTime < castDelay)
            {
                accumulatedTime += Time.deltaTime;
                yield return(null);
            }
            PerformAbilityHit(source, target, modifiedOutput);
        }
コード例 #16
0
        public override Dictionary <PrefabProfile, GameObject> Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log("ChanelledEffect.Cast(" + source + ", " + (target == null ? "null" : target.name) + ")");
            if (target == null)
            {
                // maybe target died or despawned in the middle of cast?
                return(null);
            }
            if (abilityEffectInput == null)
            {
                abilityEffectInput = new AbilityEffectOutput();
            }
            Dictionary <PrefabProfile, GameObject> returnObjects = base.Cast(source, target, originalTarget, abilityEffectInput);

            if (prefabObjects != null)
            {
                foreach (PrefabProfile prefabProfile in prefabObjects.Keys)
                {
                    prefabObjects[prefabProfile].transform.parent = PlayerManager.MyInstance.MyEffectPrefabParent.transform;
                    IChanneledObject channeledObjectScript = prefabObjects[prefabProfile].GetComponent <IChanneledObject>();
                    if (channeledObjectScript != null)
                    {
                        GameObject prefabParent         = source.MyCharacterUnit.gameObject;
                        Transform  usedPrefabSourceBone = null;
                        if (prefabProfile.MyTargetBone != null && prefabProfile.MyTargetBone != string.Empty)
                        {
                            usedPrefabSourceBone = prefabParent.transform.FindChildByRecursive(prefabProfile.MyTargetBone);
                        }
                        if (usedPrefabSourceBone != null)
                        {
                            prefabParent = usedPrefabSourceBone.gameObject;
                        }
                        channeledObjectScript.MyStartObject = prefabParent;
                        //channeledObjectScript.MyStartPosition = source.MyCharacterUnit.GetComponent<Collider>().bounds.center - source.MyCharacterUnit.transform.position;
                        channeledObjectScript.MyStartPosition = prefabProfile.MyPosition;
                        //channeledObjectScript.MyStartPosition = prefabParent.transform.TransformPoint(prefabOffset);
                        channeledObjectScript.MyEndObject   = target.gameObject;
                        channeledObjectScript.MyEndPosition = target.GetComponent <Collider>().bounds.center - target.transform.position;
                    }
                    else
                    {
                        //Debug.Log(MyName + ".ChanelledEffect.Cast(" + source + ", " + (target == null ? "null" : target.name) + "): CHECK INSPECTOR, CHANNELEDOBJECT NOT FOUND");
                    }
                }

                // delayed damage
                //source.StartCoroutine(PerformAbilityHitDelay(source, target, abilityEffectInput));
                source.MyCharacterAbilityManager.BeginPerformAbilityHitDelay(source, target, abilityEffectInput, this);
            }
            return(returnObjects);
        }
コード例 #17
0
        /// <summary>
        /// Does the actual work of hitting the target with an ability
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public override void PerformAbilityHit(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(abilityEffectName + ".HealEffect.PerformAbilityEffect(" + source.name + ", " + (target == null ? "null" : target.name) + ") effect: " + abilityEffectName);
            int             healthFinalAmount = 0;
            CombatMagnitude combatMagnitude   = CombatMagnitude.normal;

            if (useHealthAmount == true)
            {
                float healthTotalAmount = healthBaseAmount + (healthAmountPerLevel * source.MyCharacterStats.MyLevel);
                KeyValuePair <float, CombatMagnitude> abilityKeyValuePair = CalculateAbilityAmount(healthTotalAmount, source, target.GetComponent <CharacterUnit>(), abilityEffectInput);
                healthFinalAmount = (int)abilityKeyValuePair.Key;
                combatMagnitude   = abilityKeyValuePair.Value;
                //healthFinalAmount = (int)CalculateAbilityAmount(healthTotalAmount, source, target.GetComponent<CharacterUnit>(), abilityEffectInput).Key;
            }
            healthFinalAmount += (int)(abilityEffectInput.healthAmount * inputMultiplier);

            AbilityEffectOutput abilityEffectOutput = new AbilityEffectOutput();

            abilityEffectOutput.healthAmount = healthFinalAmount;
            if (healthFinalAmount > 0)
            {
                target.GetComponent <CharacterUnit>().MyCharacter.MyCharacterStats.RecoverHealth(healthFinalAmount, source, true, combatMagnitude);
            }
            int manaFinalAmount = 0;

            combatMagnitude = CombatMagnitude.normal;
            if (useManaAmount == true)
            {
                float manaTotalAmount = manaBaseAmount + (manaAmountPerLevel * source.MyCharacterStats.MyLevel);
                KeyValuePair <float, CombatMagnitude> abilityKeyValuePair = CalculateAbilityAmount(manaBaseAmount, source, target.GetComponent <CharacterUnit>(), abilityEffectInput);
                manaFinalAmount = (int)abilityKeyValuePair.Key;
                combatMagnitude = abilityKeyValuePair.Value;
                //manaFinalAmount = (int)CalculateAbilityAmount(manaBaseAmount, source, target.GetComponent<CharacterUnit>(), abilityEffectInput).Key;
            }
            manaFinalAmount += (int)(abilityEffectInput.manaAmount * inputMultiplier);
            abilityEffectOutput.manaAmount = manaFinalAmount;
            if (manaFinalAmount > 0)
            {
                target.GetComponent <CharacterUnit>().MyCharacter.MyCharacterStats.RecoverMana(manaFinalAmount, source, true, combatMagnitude);
            }
            abilityEffectOutput.prefabLocation = abilityEffectInput.prefabLocation;
            base.PerformAbilityHit(source, target, abilityEffectOutput);
        }
コード例 #18
0
 public override void Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
 {
     //Debug.Log("ChanelledEffect.Cast(" + source + ", " + (target == null ? "null" : target.name) + ")");
     if (abilityEffectInput == null)
     {
         abilityEffectInput = new AbilityEffectOutput();
     }
     base.Cast(source, target, originalTarget, abilityEffectInput);
     if (abilityEffectObject != null)
     {
         IChanneledObject channeledObjectScript = abilityEffectObject.GetComponent <IChanneledObject>();
         if (channeledObjectScript != null)
         {
             channeledObjectScript.MyStartObject   = source.MyCharacterUnit.gameObject;
             channeledObjectScript.MyStartPosition = source.MyCharacterUnit.GetComponent <Collider>().bounds.center - source.MyCharacterUnit.transform.position;
             channeledObjectScript.MyEndObject     = target.gameObject;
             channeledObjectScript.MyEndPosition   = target.GetComponent <Collider>().bounds.center - target.transform.position;
         }
         // delayed damage
         //source.StartCoroutine(PerformAbilityHitDelay(source, target, abilityEffectInput));
         source.MyCharacterAbilityManager.BeginPerformAbilityHitDelay(source, target, abilityEffectInput, this);
     }
 }
コード例 #19
0
        /// <summary>
        /// Does the actual work of hitting the target with an ability
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public override void PerformAbilityHit(BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(MyAbilityEffectName + ".AttackAbility.PerformAbilityEffect(" + source.name + ", " + target.name + ")");
            if (abilityEffectInput == null)
            {
                //Debug.Log("AttackEffect.PerformAbilityEffect() abilityEffectInput is null!");
            }
            if (source == null || target == null)
            {
                // something died or despawned mid cast
                return;
            }
            int abilityFinalAmount = (int)CalculateAbilityAmount(healthBaseAmount, source, target.GetComponent <CharacterUnit>()) + (int)(abilityEffectInput.healthAmount * inputMultiplier);
            AbilityEffectOutput abilityEffectOutput = new AbilityEffectOutput();

            abilityEffectOutput.healthAmount = abilityFinalAmount;
            if (abilityFinalAmount > 0)
            {
                // this effect may not have any damage and only be here for spawning a prefab or making a sound
                target.GetComponent <CharacterUnit>().MyCharacter.MyCharacterCombat.TakeDamage(abilityFinalAmount, source.MyCharacterUnit.transform.position, source, CombatType.ability, CombatMagnitude.normal, MyName);
            }
            abilityEffectOutput.prefabLocation = abilityEffectInput.prefabLocation;
            base.PerformAbilityHit(source, target, abilityEffectOutput);
        }
コード例 #20
0
        public override StatusEffectNode ApplyStatusEffect(StatusEffect statusEffect, BaseCharacter source, CharacterUnit target, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log("Playerstats.ApplyStatusEffect()");
            if (statusEffect == null)
            {
                //Debug.Log("Playerstats.ApplyStatusEffect(): statusEffect is null!");
            }
            StatusEffectNode _statusEffectNode = base.ApplyStatusEffect(statusEffect, source, target, abilityEffectInput);

            if (statusEffect.MyClassTrait == false)
            {
                if (_statusEffectNode != null)
                {
                    UIManager.MyInstance.MyStatusEffectPanelController.SpawnStatusNode(_statusEffectNode, target);
                    if (abilityEffectInput.savedEffect == false)
                    {
                        if (target != null)
                        {
                            CombatTextManager.MyInstance.SpawnCombatText(target.gameObject, statusEffect, true);
                        }
                    }
                }
            }
            return(_statusEffectNode);
        }
コード例 #21
0
        public override StatusEffectNode ApplyStatusEffect(StatusEffect statusEffect, BaseCharacter source, CharacterUnit target, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log("AISats.ApplyStatusEffect()");
            StatusEffectNode _statusEffectNode = base.ApplyStatusEffect(statusEffect, source, target, abilityEffectInput);

            if (_statusEffectNode != null && _statusEffectNode.MyStatusEffect.MyControlTarget == true)
            {
                ApplyControlEffects(source);
            }
            return(_statusEffectNode);
        }
コード例 #22
0
        public override Dictionary <PrefabProfile, GameObject> Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
        {
            if (target == null)
            {
                Debug.Log(MyName + ".CapturePetEffect.Cast(): target is null, returning");
                return(null);
            }

            Dictionary <PrefabProfile, GameObject> returnValue = base.Cast(source, target, originalTarget, abilityEffectInput);

            BaseCharacter targetCharacter = target.GetComponent <BaseCharacter>();

            if (targetCharacter != null && targetCharacter.MyCharacterStats != null && targetCharacter.MyCharacterStats is AIStats)
            {
                Debug.Log(MyName + ".CapturePetEffect.Cast(): applying control effects");
                (targetCharacter.MyCharacterStats as AIStats).ApplyControlEffects(source);
            }

            if (source.MyCharacterPetManager != null && targetCharacter != null && targetCharacter.MyUnitProfile != null)
            {
                Debug.Log(MyName + ".CapturePetEffect.Cast(): adding to pet manager");
                source.MyCharacterPetManager.AddPet(targetCharacter.MyUnitProfile);
                source.MyCharacterPetManager.MyActiveUnitProfiles.Add(targetCharacter.MyUnitProfile, target);
            }

            return(returnValue);
        }
コード例 #23
0
 public void HandleCollission(BaseCharacter source, GameObject target, GameObject _abilityEffectObject, AbilityEffectOutput abilityEffectInput)
 {
     //Debug.Log(MyName + ".ProjectileEffect.HandleCollission()");
     PerformAbilityHit(source, target, abilityEffectInput);
     Destroy(_abilityEffectObject);
 }
コード例 #24
0
        public override Dictionary <PrefabProfile, GameObject> Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(MyName + ".ProjectileEffect.Cast(" + source.name + ", " + (target == null ? "null" : target.name) + ")");
            Dictionary <PrefabProfile, GameObject> returnObjects = base.Cast(source, target, originalTarget, abilityEffectInput);

            if (returnObjects != null)
            {
                foreach (GameObject go in returnObjects.Values)
                {
                    //Debug.Log(MyName + ".ProjectileEffect.Cast(): found gameobject: " + go.name);
                    go.transform.parent = PlayerManager.MyInstance.MyEffectPrefabParent.transform;
                    ProjectileScript projectileScript = go.GetComponent <ProjectileScript>();
                    if (projectileScript != null)
                    {
                        //Debug.Log(MyName + ".ProjectileEffect.Cast(): found gameobject: " + go.name + " and it has projectile script");
                        abilityEffectInput = ApplyInputMultiplier(abilityEffectInput);
                        projectileScript.Initialize(projectileSpeed, source, target, new Vector3(0, 1, 0), abilityEffectInput);
                        projectileScript.OnCollission += HandleCollission;
                    }
                }
            }
            return(returnObjects);
        }
コード例 #25
0
ファイル: AIStats.cs プロジェクト: lemdoublev/AnyRPGAlphaCode
        public override StatusEffectNode ApplyStatusEffect(StatusEffect statusEffect, BaseCharacter sourceCharacter, CharacterUnit target, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(gameObject + ".AISats.ApplyStatusEffect()");
            StatusEffectNode _statusEffectNode = base.ApplyStatusEffect(statusEffect, sourceCharacter, target, abilityEffectInput);

            if (_statusEffectNode != null && _statusEffectNode.MyStatusEffect.MyControlTarget == true)
            {
                //Debug.Log(gameObject + ".AISats.ApplyStatusEffect() : disabling ai patrol");
                if ((baseCharacter.MyCharacterController as AIController).MyAiPatrol != null)
                {
                    (baseCharacter.MyCharacterController as AIController).MyAiPatrol.enabled = false;
                }
                (baseCharacter.MyCharacterController as AIController).ChangeState(new IdleState());
                ApplyControlEffects(sourceCharacter);
                if (sourceCharacter.MyCharacterPetManager != null && target.MyCharacter != null && target.MyCharacter.MyUnitProfile != null)
                {
                    sourceCharacter.MyCharacterPetManager.AddPet(target.MyCharacter.MyUnitProfile);
                }
            }
            return(_statusEffectNode);
        }
コード例 #26
0
 protected override void CheckDestroyObjects(Dictionary <PrefabProfile, GameObject> abilityEffectObjects, BaseCharacter source, GameObject target, AbilityEffectOutput abilityEffectInput)
 {
     // intentionally not calling base to avoid getting our pet destroyed
 }
コード例 #27
0
        /*
         * // The prefab to summon
         * [SerializeField]
         * private GameObject summonObject;
         */

        /*
         * [SerializeField]
         * private Vector3 spawnLocation = Vector3.zero;
         */

        public override Dictionary <PrefabProfile, GameObject> Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(MyName + ".SummonEffect.Cast()");
            base.Cast(source, target, originalTarget, abilityEffectInput);
            Dictionary <PrefabProfile, GameObject> returnObjects = Spawn(source);

            return(returnObjects);
        }
コード例 #28
0
 public void HandleCollission(BaseCharacter source, GameObject target, GameObject _abilityEffectObject, AbilityEffectOutput abilityEffectInput)
 {
     PerformAbilityHit(source, target, abilityEffectInput);
     Destroy(_abilityEffectObject);
 }
コード例 #29
0
        /*
         * // bypass the creation of the status effect and just make its visual prefab
         * public void RawCast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput) {
         *  base.Cast(source, target, originalTarget, abilityEffectInput);
         * }
         */

        public override Dictionary <PrefabProfile, GameObject> Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log("StatusEffect.Cast(" + source.name + ", " + (target? target.name : "null") + ")");
            if (!CanUseOn(target, source))
            {
                return(null);
            }
            Dictionary <PrefabProfile, GameObject> returnObjects = base.Cast(source, target, originalTarget, abilityEffectInput);
            PrefabProfile prefabProfile       = returnObjects.Keys.ElementAt(0);
            GameObject    abilityEffectObject = returnObjects[prefabProfile];

            GameObject go = prefabObjects.Values.ElementAt(0);

            if (abilityEffectObject != null)
            {
                // pass in the ability effect object so we can independently destroy it and let it last as long as the status effect (which could be refreshed).
                abilityEffectObject.transform.parent = PlayerManager.MyInstance.MyPlayerUnitParent.transform;

                dynamicCharacterAvatar = go.GetComponent <DynamicCharacterAvatar>();
                if (dynamicCharacterAvatar != null)
                {
                    SubscribeToUMACreate();
                }
                else
                {
                    HandleMountUnitSpawn();
                }
            }
            return(returnObjects);
        }
コード例 #30
0
        public override void Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(MyName + ".ProjectileAttackEffect.Cast(" + source.name + ", " + target.name + ")");
            base.Cast(source, target, originalTarget, abilityEffectInput);
            ProjectileScript projectileScript = abilityEffectObject.GetComponent <ProjectileScript>();

            if (projectileScript != null)
            {
                abilityEffectInput = ApplyInputMultiplier(abilityEffectInput);
                projectileScript.Initialize(projectileSpeed, source, target, new Vector3(0, 1, 0), abilityEffectInput);
                projectileScript.OnCollission += HandleCollission;
            }
        }