Beispiel #1
0
    public override void Initialize()
    {
        base.Initialize();

        UpdateBaseStats();


        if (lobbed)
        {
            direction = Direction.None;

            Vector2 lobDirection = TargetingUtilities.DegreeToVector2(angle);

            if (parentProjectile.ParentFacing == Constants.EntityFacing.Left)
            {
                lobDirection = new Vector2(-lobDirection.x, lobDirection.y);
            }

            myBody.AddForce(lobDirection * maxSpeed);
        }
    }
Beispiel #2
0
    public override void Apply(GameObject target)
    {
        base.Apply(target);

        if (!CheckForSpecificTarget(target))
        {
            return;
        }



        switch (statusType)
        {
        case Constants.StatusEffectType.None:
            //Status newStatus = target.AddComponent<Status>();
            Status newStatus = new Status();


            newStatus.Initialize(target, duration, interval, statusType, parentAbility);

            StatusManager.AddStatus(target.GetComponent <Entity>(), newStatus, this, parentAbility);
            break;

        case Constants.StatusEffectType.AffectMovement:
            //AffectMovement newAffectMovement = target.AddComponent<AffectMovement>();
            AffectMovement newAffectMovement = new AffectMovement();

            knockbackVector = TargetingUtilities.DegreeToVector2(knocbackAngle);

            if (Source.Facing == Constants.EntityFacing.Left)
            {
                knockbackVector = new Vector2(-knockbackVector.x, knockbackVector.y);
            }

            newAffectMovement.Initialize(target, duration, interval, statusType, parentAbility, maxStack, onCompleteEffect);
            newAffectMovement.InitializeAffectMovement(affectMoveType, affectMoveValue, knockbackVector);

            StatusManager.AddStatus(target.GetComponent <Entity>(), newAffectMovement, this, parentAbility);
            break;

        case Constants.StatusEffectType.Stun:
            Stun newStun = new Stun();

            newStun.Initialize(target, duration, interval, statusType, parentAbility);
            newStun.InitializeStun();

            StatusManager.AddStatus(target.GetComponent <Entity>(), newStun, this, parentAbility);
            break;

        case Constants.StatusEffectType.DamageOverTime:


            float damage;
            if (scaleFromBaseDamage)
            {
                damage = damagePerInterval + (parentAbility.source.stats.GetStatModifiedValue(Constants.BaseStatType.BaseDamage) * percentOfBaseDamage);
            }
            else
            {
                damage = damagePerInterval;
            }

            //DamageOverTime newDot = target.AddComponent<DamageOverTime>();
            DamageOverTime newDot = new DamageOverTime();
            newDot.Initialize(target, duration, interval, statusType, parentAbility, maxStack);
            newDot.InitializeDamageOverTime(damage, parentAbility.source);

            StatusManager.AddStatus(target.GetComponent <Entity>(), newDot, this, parentAbility);

            Debug.Log("Applying " + damage + " over time");

            break;

        case Constants.StatusEffectType.StaticStatAdjustment:
            StatCollection.StatModifer modStatic = new StatCollection.StatModifer(statAdjustmentValue, modType);

            Debug.Log("Stat " + statType + " is being adjusted by " + statAdjustmentValue);

            CombatManager.ApplyTrackedStatMod(Source, target.GetComponent <Entity>(), statType, modStatic);

            break;

        case Constants.StatusEffectType.DurationalStatAdjustment:
            //StatCollection.StatModifer modDur = new StatCollection.StatModifer(statAdjustmentValue, modType);

            Debug.Log("Setting durational stuff");

            DurationalStatChange newDurationalStatChange = new DurationalStatChange();
            newDurationalStatChange.Initialize(target, duration, interval, statusType, parentAbility, maxStack);
            newDurationalStatChange.InitializeDurationalStatChange(statType, modType, statAdjustmentValue);

            StatusManager.AddStatus(target.GetComponent <Entity>(), newDurationalStatChange, this, parentAbility);

            break;
        }
    }