Exemple #1
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(IAbilityCaster source, Interactable target, Interactable originalTarget, AbilityEffectContext abilityEffectInput)
        {
            //Debug.Log("StatusEffect.Cast(" + source.name + ", " + (target? target.name : "null") + ")");
            if (!CanUseOn(target, source))
            {
                //Debug.Log("StatusEffect.Cast(" + source.name + ", " + (target ? target.name : "null") + ") CANNOT USE RETURNING");
                return(null);
            }
            Dictionary <PrefabProfile, GameObject> returnObjects = base.Cast(source, target, originalTarget, abilityEffectInput);
            // make ourselves the top threat in his threat table
            CharacterUnit targetCharacterUnit = CharacterUnit.GetCharacterUnit(target);

            if (targetCharacterUnit != null)
            {
                if (targetCharacterUnit.BaseCharacter != null && targetCharacterUnit.BaseCharacter.CharacterCombat != null && targetCharacterUnit.BaseCharacter.CharacterCombat.AggroTable != null)
                {
                    //Debug.Log("StatusEffect.Cast(" + source.name + ", " + (target ? target.name : "null") + ") CHARACTER COMBAT IS NOT NULL");
                    AggroNode AgroNode      = targetCharacterUnit.BaseCharacter.CharacterCombat.AggroTable.MyTopAgroNode;
                    float     usedAgroValue = 0f;
                    if (AgroNode != null)
                    {
                        usedAgroValue = AgroNode.aggroValue;
                    }
                    if (source != null)
                    {
                        source.AbilityManager.GenerateAgro(targetCharacterUnit, (int)(usedAgroValue + extraThreat));
                    }
                }
            }

            // override aggro checks

            return(returnObjects);
        }
Exemple #2
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))
            {
                //Debug.Log("StatusEffect.Cast(" + source.name + ", " + (target ? target.name : "null") + ") CANNOT USE RETURNING");
                return(null);
            }
            Dictionary <PrefabProfile, GameObject> returnObjects = base.Cast(source, target, originalTarget, abilityEffectInput);
            // make ourselves the top threat in his threat table
            CharacterUnit targetCharacterUnit = target.GetComponent <CharacterUnit>();

            if (targetCharacterUnit != null)
            {
                if (targetCharacterUnit.MyCharacter != null && targetCharacterUnit.MyCharacter.MyCharacterCombat != null && targetCharacterUnit.MyCharacter.MyCharacterCombat.MyAggroTable != null)
                {
                    //Debug.Log("StatusEffect.Cast(" + source.name + ", " + (target ? target.name : "null") + ") CHARACTER COMBAT IS NOT NULL");
                    AggroNode AgroNode      = targetCharacterUnit.MyCharacter.MyCharacterCombat.MyAggroTable.MyTopAgroNode;
                    float     usedAgroValue = 0f;
                    if (AgroNode != null)
                    {
                        usedAgroValue = AgroNode.aggroValue;
                    }
                    if (source != null && source.MyCharacterUnit != null)
                    {
                        targetCharacterUnit.MyCharacter.MyCharacterCombat.MyAggroTable.AddToAggroTable(source.MyCharacterUnit, (int)(usedAgroValue + extraThreat));
                        AgroNode = targetCharacterUnit.MyCharacter.MyCharacterCombat.MyAggroTable.MyTopAgroNode;
                        //Debug.Log("StatusEffect.Cast(" + source.name + ", " + (target ? target.name : "null") + ") topNode agro value: " + AgroNode.aggroValue + "; target: " + AgroNode.aggroTarget.MyName);
                        targetCharacterUnit.MyCharacter.MyCharacterCombat.MyAggroTable.LockAgro();
                    }
                }
            }

            // override aggro checks

            return(returnObjects);
        }