Beispiel #1
0
    private void CreateStatMod()
    {
        Debug.Log("Creating a stat mod : " + targetStat + " " + statAdjValue);

        StatCollection.StatModifer mod = new StatCollection.StatModifer(statAdjValue, modType);
        mods.Add(mod);
        CombatManager.ApplyTrackedStatMod(source, targetEntity, targetStat, mod);
    }
Beispiel #2
0
    public void InitializeAffectMovement(AffectMovementType type, float value, Vector2 knockback)
    {
        affectType     = type;
        amount         = value;
        targetMovement = target.GetComponent <BaseMovement>();

        switch (affectType)
        {
        case AffectMovementType.Halt:

            if (targetMovement == null)
            {
                return;
            }

            if (targetMovement is EntityMovement)
            {
                if (((EntityMovement)targetMovement).Grounded || ((EntityMovement)targetMovement).Platformed)
                {
                    target.GetComponent <Rigidbody2D>().velocity = Vector2.zero;
                }
            }

            targetMovement.CanMove  = false;
            targetMovement.CanPivot = false;
            break;

        case AffectMovementType.Knockback:
            target.GetComponent <Rigidbody2D>().velocity = Vector2.zero;
            targetMovement.CanMove = false;

            target.GetComponent <Rigidbody2D>().AddForce(knockback * value);

            break;

        case AffectMovementType.AlterSpeed:
            mod = new StatCollection.StatModifer(amount, StatCollection.StatModificationType.Multiplicative);

            //Debug.Log("Applyin a mod of " + mod.value);

            CombatManager.ApplyTrackedStatMod(source, targetEntity, Constants.BaseStatType.MoveSpeed, mod);

            //CombatManager.ApplyUntrackedStatMod(source, target.GetComponent<Entity>(), Constants.BaseStatType.MoveSpeed, amount, StatCollection.StatModificationType.Multiplicative);
            break;
        }
    }
Beispiel #3
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;
        }
    }