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);
        StatAdjustmentManager.ApplyTrackedStatMod(source, targetEntity, targetStat, mod);
    }
Beispiel #2
0
    private void CreateAndApplyStatMod()
    {
        if (permanent == false)
        {
            StatModifier mod = new StatModifier(adjValue, modType);
            mods.Add(mod);

            StatAdjustmentManager.ApplyTrackedStatMod(SourceEffect.ParentAbility.Source.GetStats(), Target.GetStats(), targetStat, mod, options);
        }
        else
        {
            StatAdjustmentManager.ApplyUntrackedStatMod(SourceEffect.ParentAbility.Source.GetStats(), Target.GetStats(), targetStat, adjValue, modType, options);
        }
    }
    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);

            ((MovingEntity)targetEntity).ModifyVelociy(knockback * value);

            break;

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

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

            StatAdjustmentManager.ApplyTrackedStatMod(source, targetEntity, StatCollection.BaseStat.BaseStatType.MoveSpeed, mod);

            //CombatManager.ApplyUntrackedStatMod(source, target.GetComponent<Entity>(), Constants.BaseStatType.MoveSpeed, amount, StatCollection.StatModificationType.Multiplicative);
            break;

        case AffectMovementType.SuspendInAir:
            ((MovingEntity)targetEntity).ResetY();
            break;
        }
    }
 public void AddMaxCharge(StatCollection source, StatModifier mod)
 {
     StatAdjustmentManager.ApplyTrackedStatMod(source, RecoveryStats, BaseStat.StatType.AbilityCharge, mod, StatCollection.StatModifierOption.Cap);
 }
Beispiel #5
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);
            knockbackVector = TargetingUtilities.DirectionFromAngle(knocbackAngle, false);

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

            //Debug.Log(knockbackVector + " is the knockback vector");

            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(StatCollection.BaseStat.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);

            StatAdjustmentManager.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;
        }
    }
Beispiel #6
0
 public void ModifyCoolDown(StatCollection cause, StatModifier mod)
 {
     StatAdjustmentManager.ApplyTrackedStatMod(cause, Stats, BaseStat.StatType.CoolDown, mod);
 }