示例#1
0
 protected void objectEffect(BuffableObject obj, BuffableObject target)
 {
     target.states[(int)TypesOfStates.MovementLock] = ObjectStates.ControlLocked;
     target.states[(int)TypesOfStates.Status]       = ObjectStates.Stun;
     target.states[(int)TypesOfStates.Attack]       = ObjectStates.Idle;
     target.setVelocity(new Vector2(0, target.Velocity.Y));
 }
示例#2
0
    public float useAttackDamage(BuffableObject target)
    {
        float?killChance = useStat(StatTypes.InstantKill, target);

        if (killChance != null && new Random().Next(100) + 1 < killChance)
        {
            return(999999999);
        }
        else
        {
            float?attack = useStat(StatTypes.Attack, target);
            if (attack != null)
            {
                float?critChance = useStat(StatTypes.CritChance, target);
                if (critChance != null && new Random().Next(100) + 1 < critChance)
                {
                    return((float)attack * (1 + (float)useStat(StatTypes.CritDamage, target) / 100));
                }
                else
                {
                    return((float)attack);
                }
            }
        }
        return(0);
    }
示例#3
0
 public float?useStat(StatTypes statType, BuffableObject target = null)
 {
     foreach (Effect effect in effects)
     {
         effect.triggerEffect(statType, this, target);
     }
     return(calculateStat(statType));
 }
示例#4
0
    protected void objectEffect(BuffableObject obj, BuffableObject target)
    {
        target.states[(int)TypesOfStates.MovementLock] = ObjectStates.ControlLocked;
        target.states[(int)TypesOfStates.Status]       = ObjectStates.Knockback;
        target.states[(int)TypesOfStates.Attack]       = ObjectStates.Idle;
        Vector2 vec   = target.Position - obj.Position;
        float   scale = (float)Math.Sqrt(Math.Pow(BuffableObject.KNOCKBACK_SPEED, 2) / (Math.Pow(Math.Abs(vec.X), 2) + Math.Pow(Math.Abs(vec.Y), 2)));

        target.setVelocity(scale * vec);
    }
示例#5
0
 public float triggerEffect(StatTypes statType, BuffableObject obj, BuffableObject target = null)
 {
     if (triggerStats.Exists(x => x == statType))
     {
         if (effectTarget == EffectTargets.Target)
         {
             if (buff != null)
             {
                 target.addBuff(new Buff(buff));
             }
             objectEffect(obj, target);
         }
         else
         {
             if (buff != null)
             {
                 obj.addBuff(new Buff(buff));
             }
             objectEffect(target, obj);
         }
     }
     return(0);
 }
示例#6
0
 virtual protected void objectEffect(BuffableObject obj, BuffableObject target)
 {
 }