Exemplo n.º 1
0
        public void SetupFixBuzProtoForTest()
        {
            IEnumerable<int> list = Enumerable.Range(0, 16);
            List<ValueTokenPair<int, string>> pairs = new List<ValueTokenPair<int, string>> {
                new ValueTokenPair<int, string> {Value=3, Token=fiz},
                new ValueTokenPair<int, string> {Value=5, Token=buz}
            };

            caster = new IntToStringCaster();
            evaluator = new DivisorEvaluator();
            listEvaler = new ListEvaluator<int, int, string>(list, pairs, caster, evaluator);
        }
Exemplo n.º 2
0
 public Rejuvenation(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 3
0
 public FirstAid(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 4
0
 //Inflects buff/debuff on target
 protected void inflictBuff(ICaster target, ICaster caster, float mod)
 {
     target.BuffDebuff.modify(buff.multiply(Mathf.CeilToInt(mod)));
 }
Exemplo n.º 5
0
 public DepressionDarkElf(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 6
0
 public Meditation(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 7
0
 public override bool HasValidTarget(ICaster caster, out Target target)
 {
     target = new Target(caster.System.Origin.gameObject, caster.System.Origin.position);
     return(true);
 }
Exemplo n.º 8
0
 public ManaDrainSeer(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 9
0
    //Applies damage formula base on base_power (spell strength) and stats of caster and target)
    //damages ref stats appropriately (will not go below zero)
    //Precondition: target.Stats.vsElement[element] != Elements.repel
    public static bool calcDamage(CastData data, int base_power, int element, ICaster caster, ICaster target, bool crit, bool is_stunned = false)
    {
        float dMod          = base_power;
        int   staggerDamage = 0;

        //Apply buff/debuffs here (NOT DONE)
        CasterStats casterMod = applyBuff(caster);
        CasterStats targetMod = applyBuff(target);

        //Apply attack bonus formula here
        dMod *= casterMod.attack;

        //Absorb damage if enemy absorbs this type
        if (targetMod.vsElement[element] == Elements.drain)
        {
            Debug.Log(target.Stats.name + " absorbs " + dMod + " " + Elements.toString(element) + " damage");
            if (target.Curr_hp + Mathf.CeilToInt(dMod) > target.Stats.max_hp)
            {
                target.Curr_hp = target.Stats.max_hp;
            }
            else
            {
                target.Curr_hp += Mathf.CeilToInt(dMod);
            }

            data.damageInflicted = Mathf.CeilToInt(-1 * dMod);
            data.vsElement       = Elements.vsElement.DRAIN;
            return(false);
        }

        //Subtract enemy defense penalty here
        dMod = dMod - (dMod * targetMod.defense);

        //Add random modifier here
        dMod *= Random.Range(0.9F, 1.1F);

        //Apply crit here
        if (crit)
        {
            staggerDamage++;
        }

        //Apply elemental weakness/resistances
        dMod *= targetMod.vsElement[element];
        if (targetMod.vsElement[element] == 0.0F)
        {
            data.vsElement = Elements.vsElement.BLOCK;
        }
        else if (targetMod.vsElement[element] > 1)//If enemy is weak
        {
            if (targetMod.vsElement[element] > 2)
            {
                data.vsElement = Elements.vsElement.SUPERWEAK;
            }
            else
            {
                data.vsElement = Elements.vsElement.WEAK;
            }
            staggerDamage++;
        }
        else if (targetMod.vsElement[element] < 1)
        {
            data.vsElement = Elements.vsElement.RESIST;
        }
        else
        {
            data.vsElement = Elements.vsElement.NEUTRAL;
        }

        //Apply stun damage mod (if stunned)
        if (is_stunned)
        {
            dMod *= (1.25F + (0.25F * staggerDamage));
        }
        //Apply shield
        if (target.Curr_shield > 0)
        {
            if (target.Curr_shield - dMod < 0)//Shield breaks
            {
                target.Curr_shield = 0;
                target.Curr_hp    -= Mathf.CeilToInt(dMod - target.Curr_shield);
                if (staggerDamage >= 1 && is_stunned == false)
                {
                    target.Curr_stagger--;
                }
            }
            else
            {
                target.Curr_shield -= Mathf.CeilToInt(dMod);
            }
        }
        else
        {
            target.Curr_hp -= Mathf.CeilToInt(dMod);
            //Stagger if enemy is actually damaged
            if (staggerDamage >= 1 && !is_stunned && dMod > 0)
            {
                target.Curr_stagger--;
            }
        }
        if (target.Curr_hp < 0)
        {
            target.Curr_hp = 0;
        }
        if (target.Curr_hp > target.Stats.max_hp)
        {
            target.Curr_hp = target.Stats.max_hp;
        }
        data.damageInflicted = Mathf.CeilToInt(dMod);
        return(dMod > 0);
    }
Exemplo n.º 10
0
 //Applies ICaster's buff/debuff state to its stats
 public static CasterStats applyBuff(ICaster caster)
 {
     return(caster.Stats.modify(caster.BuffDebuff));
 }
Exemplo n.º 11
0
 public CastSpellBattleEvent(Ability a, ICaster c) : base(a, c)
 {
 }
Exemplo n.º 12
0
 public abstract CreateSpellCastResult CanCast(ICaster caster, SpellState spellState);
Exemplo n.º 13
0
 public Fireball(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 14
0
 public RemoteLockManager(RecordViewTableMapFactory aRecordViewTableMapFactory
                          , ICaster aCaster)
     : base(aRecordViewTableMapFactory, aCaster)
 {
 }
Exemplo n.º 15
0
 public BooleanComparer()
 {
     caster = new ThreeStateBooleanCaster();
 }
Exemplo n.º 16
0
 //Used to set location data
 public void setLocationData(ICaster target, ICaster caster)
 {
     this.target = target;
     this.caster = caster;
 }
Exemplo n.º 17
0
 public SicknessDarkElf(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 18
0
 public FlourishSeer(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 19
0
 public abstract bool HasValidTarget(ICaster caster, out Target target);
Exemplo n.º 20
0
 public override bool HasValidTarget(ICaster caster, out Target target)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 21
0
 public override void Cast(ICaster caster)
 {
     finished = true;
 }
 public DarkenstoneHellDragon(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 23
0
 public FireShotDragon(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 24
0
    //public methods

    //Casts this spell at selected target (at targets[selected])
    public abstract CastData cast(ICaster target, ICaster caster);
Exemplo n.º 25
0
 public StingGoblin(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 26
0
 public override CastData cast(ICaster target, ICaster caster)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 27
0
 public Min(ICaster <T> caster) : base(caster)
 {
 }
Exemplo n.º 28
0
 public SwipeMurloc(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 29
0
 public GunShotGoblin(ICaster caster)
     : this()
 {
     Caster = caster;
 }
Exemplo n.º 30
0
 public NumericComparer()
 {
     caster = new NumericCaster();
 }
Exemplo n.º 31
0
 public LightningBoltSeer(ICaster caster)
     : this()
 {
     Caster = caster;
 }