Beispiel #1
0
 public void Cast()
 {
     if (spell.spellType == SpellType.Destruction)
     {
         DestructionSpell destructionSpell = (DestructionSpell)spell;
         BattleSystem.battleSystem.PlayerCastSpell(destructionSpell);
     }
     else if (spell.spellType == SpellType.Restoration)
     {
         RestorationSpell restorationSpell = (RestorationSpell)spell;
         BattleSystem.battleSystem.PlayerCastSpell(restorationSpell);
     }
     else if (spell.spellType == SpellType.StatusEffect)
     {
         StatusEffectSpell statusEffectSpell = (StatusEffectSpell)spell;
         BattleSystem.battleSystem.PlayerCastSpell(statusEffectSpell);
     }
 }
Beispiel #2
0
    IEnumerator PlayerCastRestorationSpellTxt(RestorationSpell spell)
    {
        if (player1.mana - spell.manaCost < 0)
        {
            optionMenu.SetFullText(player1.characterName + " is out of mana");
            yield return(new WaitForSeconds(2f));
        }
        else
        {
            float hp = spell.hitpoint.roll();
            optionMenu.SetFullText(player1.characterName + " cast " + spell.spellName + " and restore " + hp + " hitpoint");
            yield return(new WaitForSeconds(2f));

            player1.TriggerSpellAnimation();
            yield return(new WaitForSeconds(2f));

            player1.SetMana(spell.manaCost);
            player1.TakeDamage(-hp);
        }

        StartCoroutine(PlayerAnimationEnd());
    }
Beispiel #3
0
    // Return an instance of the type's archetypal class.
    public static Item FromType(Types type)
    {
        Item             ret = null;
        MeleeWeapon      mw;
        ProjectileWeapon pw;
        ThrownItem       ti;
        SpellCaster      sc;
        ItemData         dat;
        RestorationSpell rs;

        switch (type)
        {
        case Types.Hand: ret = new MeleeWeapon() as Item; break;

        case Types.Rifle: ret = new ProjectileWeapon() as Item; break;

        case Types.Bullet:
            ret           = new Projectile() as Item;
            ret.stackable = true;
            break;

        case Types.HealthPack:  ret = new HealthPowerUp() as Item; break;

        case Types.AmmoPack: ret = new AmmoPowerUp() as Item; break;

        case Types.Ammo:
            ret           = new Item();
            ret.stackable = true;
            break;

        case Types.AidHealthPack: ret = new HealthAid() as Item; break;

        case Types.Spear:
            ti = new ThrownItem();
            ti.healthDamage = 100;
            ti.staminaCost  = 25;
            ret             = ti as Item;
            ret.color       = new Vector3(0, 1, 0);
            break;

        case Types.Claws:
            mw = new MeleeWeapon();
            mw.healthDamage = 50;
            mw.swingSpeed   = 0.5f;
            mw.staminaCost  = 15;
            ret             = mw as Item;
            break;

        case Types.Staff:
            List <Types> spells = Session.session.career.GetAvailableSpells();
            sc  = new SpellCaster(spells);
            ret = sc as Item;
            break;

        case Types.Crossbow:
            pw = new ProjectileWeapon();
            pw.healthDamage    = 100;
            pw.maxAmmo         = 1;
            pw.ammoType        = "Bolt";
            pw.impulseStrength = 100f;
            dat      = new ItemData();
            dat.type = Types.Ammo;
            dat.name = pw.ammoType;
            pw.LoadInternalReserve(dat, 10);
            ret = pw as Item;
            break;

        case Types.RapidCrossbow:
            pw = new ProjectileWeapon();
            pw.healthDamage    = 100;
            pw.maxAmmo         = 1;
            pw.ammoType        = "Bolt";
            pw.impulseStrength = 100f;
            pw.reloadDelay     = 0.5f; // Four times faster
            dat      = new ItemData();
            dat.type = Types.Ammo;
            dat.name = pw.ammoType;
            pw.LoadInternalReserve(dat, 10);
            ret = pw as Item;
            break;

        case Types.DoubleCrossbow:
            pw = new ProjectileWeapon();
            pw.healthDamage    = 100;
            pw.maxAmmo         = 2;
            pw.ammoType        = "Bolt";
            pw.impulseStrength = 100f;
            dat      = new ItemData();
            dat.type = Types.Ammo;
            dat.name = pw.ammoType;
            pw.LoadInternalReserve(dat, 10);
            ret = pw as Item;
            break;

        case Types.FlintlockPistol:
            pw = new ProjectileWeapon();
            pw.healthDamage    = 100;
            pw.maxAmmo         = 1;
            pw.ammoType        = "MusketBall";
            pw.impulseStrength = 100f;
            dat      = new ItemData();
            dat.type = Types.Ammo;
            dat.name = pw.ammoType;
            pw.LoadInternalReserve(dat, 6);
            ret = pw as Item;
            break;

        case Types.Knife:
            mw = new MeleeWeapon();
            mw.healthDamage = 35;
            mw.swingSpeed   = 0.5f;
            mw.staminaCost  = 15;
            ret             = mw as Item;
            break;

        case Types.FireballSpell:
            pw = new ProjectileWeapon();
            pw.healthDamage      = 30;
            pw.requireAmmoToFire = false;
            pw.ammoType          = "Fireball";
            pw.manaCost          = 15;
            dat      = new ItemData();
            dat.type = Types.Ammo;
            dat.name = pw.ammoType;
            pw.LoadInternalReserve(dat, 1);
            ret = pw as Item;
            break;

        case Types.FireballIISpell:
            pw = new ProjectileWeapon();
            pw.healthDamage      = 60;
            pw.requireAmmoToFire = false;
            pw.ammoType          = "Fireball";
            pw.manaCost          = 20;
            dat      = new ItemData();
            dat.type = Types.Ammo;
            dat.name = pw.ammoType;
            pw.LoadInternalReserve(dat, 1);
            ret = pw as Item;
            break;

        case Types.FireballIIISpell:
            pw = new ProjectileWeapon();
            pw.healthDamage      = 100;
            pw.requireAmmoToFire = false;
            pw.ammoType          = "Fireball";
            pw.manaCost          = 50;
            dat      = new ItemData();
            dat.type = Types.Ammo;
            dat.name = pw.ammoType;
            pw.LoadInternalReserve(dat, 1);
            ret = pw as Item;
            break;

        case Types.HealSpell:
            rs          = new RestorationSpell();
            rs.health   = 15;
            rs.manaCost = 50;
            rs.coolDown = 1f;
            ret         = rs as Item;
            break;

        case Types.StaminaSpell:
            rs          = new RestorationSpell();
            rs.stamina  = 15;
            rs.manaCost = 15;
            rs.coolDown = 0.5f;
            ret         = rs as Item;
            break;

        case Types.ManaSpell:
            rs          = new RestorationSpell();
            rs.mana     = 25;
            rs.manaCost = 15;
            rs.coolDown = 0.5f;
            ret         = rs as Item;
            break;
        }
        return(ret);
    }
Beispiel #4
0
 public void PlayerCastSpell(RestorationSpell restorationSpell)
 {
     StartCoroutine(PlayerCastRestorationSpellTxt(restorationSpell));
 }