示例#1
0
    /** LaunchSpell : public override void Method
     * The LauncheSpell Method is called by the abstract Class Classe when the player press the key associated to the spell.
     * First at all, we launch the mother method to initialize the spell launching.
     * If the spell is Launcheable, we create a new List that will contains the targets freshly affected by new IgniteStatus.
     * Then, we explode every targets already affected by an IgniteStatus (making damage to this target).
     * In order to get the new targets that are getting new igniteStatus, we use an overlapSphere.
     * For every collider touched by the overlap sphere we only want to get Colliders of Monsters that have not explosed and are not explosable.
     * Once we get the correct targets, We first apply an explosion damage.
     * Then, we launch a random to instantiate or not ignite on the correct target.
     * Please note that the random can be ignored if CritSuccess was set to true by the FireBlessingSpell.
     * If the random is a success, we instantiate a fresh Ignite child of the target (by adding a new one or reseting the current one).
     * After that, we add the new Frsh targets with fresh ignites to the targetsToAdd List. Then, we refresh the targetsExploded list, by adding the target that just exploded
     * These steps ensures that targets can not explode 2 times and get a new fresh igniteStatus after an explosion.
     * Then, we clear the old ignites on explosed targets and we add the new fresh targets to the target List. We also ensure that CritSuccess is reset to false and we clear the FireBlessingSpell Status.
     * Finally we call the OnSpellLaunched mother method to tell the spell is not in use anymore.
     **/
    public override void LaunchSpell()
    {
        base.LaunchSpell();

        if (!IsSpellLauncheable())
        {
            return;
        }

        List <IgniteStatus> targetsToAdd = new List <IgniteStatus>();

        foreach (IgniteStatus target in Targets)
        {
            EntityLivingBase entity = target.GetComponentInParent <EntityLivingBase>();
            entity.DamageFor(Damages[0]);
            Collider[] cols = Physics.OverlapSphere(entity.transform.position, 10f);
            TargetsExploded.Add(target.GetComponent <Collider>());
            target.ExplodeIgniteStatus();

            foreach (Collider col in cols)
            {
                if (col.gameObject.GetComponent <EntityLivingBase>() &&
                    !col.isTrigger &&
                    !TargetsExploded.Contains(col) &&
                    !Targets.Contains(col.GetComponent <IgniteStatus>()))
                {
                    col.gameObject.GetComponent <EntityLivingBase>().DamageFor(Damages[0]);
                    if (Random.Range(0, 100) < int.Parse(OtherValues[0]) || CritSuccess)
                    {
                        IgniteStatus ignite = col.gameObject.GetComponentInChildren <IgniteStatus>();
                        if (ignite != null)
                        {
                            ignite.ResetStatus();
                        }
                        else
                        {
                            GameObject newIgnite = ApplyStatus(GetComponent <FireBallSpell>().Status[0], col.transform);
                            ignite = newIgnite.GetComponentInChildren <IgniteStatus>();
                        }
                        targetsToAdd.Add(ignite);
                    }
                }
            }
        }
        TargetsExploded.Clear();
        Targets.Clear();
        Targets = targetsToAdd;

        if (CritSuccess)
        {
            GetComponentInChildren <FavorOfFireStatus>().DestroyStatus();
        }

        CritSuccess = false;
        base.OnSpellLaunched();
    }
示例#2
0
    /** ApplyEffectOnHit, public void Method
     * @Params : EntityLivingBase
     * When the instance of FireBall hits an entity, this method is launched.
     * It applies damage and refresh Ignite on the target.
     **/
    public void ApplyEffectOnHit(EntityLivingBase entityHit)
    {
        entityHit.DamageFor(Damages[0]);
        IgniteStatus igniteStatus = entityHit.GetComponentInChildren <IgniteStatus>();

        if (igniteStatus != null)
        {
            igniteStatus.ResetStatus();
        }
        else
        {
            GameObject statusObj = ApplyStatus(Status[0], entityHit.transform);
            GetComponent <ConflagrationSpell>().Targets.Add(statusObj.GetComponent <IgniteStatus>());
        }
    }
示例#3
0
    /// <summary>
    /// ApplyEffect, protected void method
    /// Used by the scripts attached to the weapon and deals damaged to the target
    /// Try also to apply the WindSpiritStatus to an ally
    /// </summary>
    /// <param name="hit">Enemy</param>
    public override void ApplyEffect(EntityLivingBase hit)
    {
        hit.DamageFor(Damages[0]);
        Debug.Log("Deal " + Damages[0] + " Damage point to " + hit.name);

        PassiveWindiator passive = GetComponent <PassiveWindiator>();

        if (hit.tag != "Player")
        {
            // Need table of player so I apply status on Windiator before new features
            passive.ProcPassive(this.gameObject);
        }

        if (_windiatorSimpleAttack.colArme)
        {
            _windiatorSimpleAttack.SwapEnableArmeCol();
        }
    }
示例#4
0
    /** OnAttackHit : public void Method
     * The OnAttackHit Method should be called by every AutoAttackFireMage prefabs when they collide an EntityLivingBase.
     * When this method is launched, we cancel the RemoveShield invoke in order to reset the timer of the shield associated to the entity.
     * Then, we add a shield to the FireMage and increase the shield value. Please note that the value should be increased by 5 points every hit, with a maximum of _maxValueShield.
     * After that, we re-invoke the RemoveShield method that will occurs in _maxDurationShield seconds.
     **/
    public void OnAttackHit(EntityLivingBase eHit)
    {
        int shieldValueToAdd  = int.Parse(OtherValues[0]);
        int maxValueShield    = int.Parse(OtherValues[1]);
        int maxDurationShield = int.Parse(OtherValues[2]);

        eHit.DamageFor(Damages[0]);
        CancelInvoke("RemoveShield");

        _shield = GetComponent <Shield>();
        if (_shield == null)
        {
            _shield         = gameObject.AddComponent <Shield>();
            _shieldInstance = Instantiate(_shieldObject, transform.position + _shieldObject.transform.position, transform.rotation, this.transform);
        }

        _shield.AddShieldValue(Mathf.Clamp(shieldValueToAdd, 0, maxValueShield - _shield.ShieldValue));
        Invoke("RemoveShield", maxDurationShield);
    }
示例#5
0
 /** StatusTickBehaviour public override void
  * Apply damages every seconds on the target.
  **/
 public override void StatusTickBehaviour()
 {
     _entity.DamageFor(Damages[0]);
 }
示例#6
0
 /** ApplyAdditionalEffect, public void Method
  * @Params : EntityLivingBase
  * When the instance of SolarBurn hits the floor, an explosion occurs.
  * This method is called for every target that are caught by the Explosion.
  **/
 public void ApplyAdditionalEffect(EntityLivingBase entityHit)
 {
     entityHit.DamageFor(Damages[1]);
 }
示例#7
0
 /** ApplyEffectOnHit, public void Method
  * @Params : EntityLivingBase
  * When the instance of SolarBurn hits an entity, this method is launched.
  * It applies damages on the target.
  **/
 public void ApplyEffectOnHit(EntityLivingBase entityHit)
 {
     entityHit.DamageFor(Damages[0]);
 }