Exemplo n.º 1
0
    // Return an instance of the type's archetypal class.
    public static Item FromType(Types type)
    {
        Item ret = null;

        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;
        }

        return(ret);
    }
Exemplo n.º 2
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);
    }