Fixes issue with item lookup in LootTable for items with a special base symbol.
authordsc <david.schoonover@gmail.com>
Mon, 11 Apr 2011 12:04:49 +0000 (05:04 -0700)
committerdsc <david.schoonover@gmail.com>
Mon, 11 Apr 2011 12:04:49 +0000 (05:04 -0700)
data/types/bullets.yaml
data/types/items.yaml
data/types/loots.yaml
data/types/units.yaml
src/tanks/inventory/loot.cjs
src/tanks/thing/tank.cjs
src/tanks/thing/thing.cjs
src/tanks/thing/unit.cjs

index b73530c..ebaca76 100644 (file)
@@ -10,6 +10,11 @@ types:
         bounceLimit: 1
         stats:
             move: 2.25
+    cheatz:
+        color: '#E73075'
+        bounceLimit: 1
+        stats:
+            move: 4.50
     rocket:
         color: '#F7ADA6'
         bounceLimit: 0
index 152265f..409b8c6 100644 (file)
@@ -50,11 +50,21 @@ types:
         art:
             map_icon: '/img/items/rockets-bg-25x25.png'
             inv_icon: '/img/items/rockets-50x50.png'
+    shield_orb:
+        name: Shield Orb
+        desc: 'Generates one rotating shield sphere.'
+        tags: [ 'armor' ]
+        symbol: tanks/item/shieldgen.ShieldGenerator
+        spheres: 1
+        art:
+            map_icon: '/img/items/orbital_shield_x4-25x25.png'
+            inv_icon: '/img/items/orbital_shield_x4-50x50.png'
     shield_gen:
         name: Shield Generator
         desc: 'Generates four rotating shield spheres, each of which absorbs one impact.'
         tags: [ 'armor' ]
         symbol: tanks/item/shieldgen.ShieldGenerator
+        spheres: 4
         art:
             map_icon: '/img/items/orbital_shield_x4-25x25.png'
             inv_icon: '/img/items/orbital_shield_x4-50x50.png'
index 7c7f835..09c797e 100644 (file)
@@ -4,7 +4,7 @@ defaults:
 types:
     rich:
         items:
-            - 0.2 shield_gen
             - 0.1 super_armor
-            - 0.3 nitro
             - 0.1 rockets
+            - 0.2 shield_gen
+            - 0.6 shield_orb
index 4364e54..20af363 100644 (file)
@@ -43,6 +43,7 @@ types:
             power : 1
             speed : 0.5
             shots : 5
+        projectile: normal # cheatz
         inventory:
             equipSlots:                     # name -> Container options; implies equipsContents=true
                 weapon : { 'max':1,  'reqs':'weapon' }
index 35bdebf..10353e4 100644 (file)
@@ -23,8 +23,10 @@ evt.subclass('LootTable', {
         return this.items.reduce(this._roll, null);
     },
     
-    _roll : function _roll(drop, o){
-        return drop || (Math.random() < o.p ? o.item : null);
+    _roll : function _roll(drop, o, idx){
+        var dice = Math.random();
+        // console.log('roll('+idx+'):', drop, '|| '+dice.toFixed(3)+' < '+o.p+' ?', o.item, 'o: '+o, o);
+        return drop || (dice < o.p ? o.item : null);
     }
     
 })
@@ -51,7 +53,7 @@ LootTable.on('speciate',
                 ,   p   = parseFloat(spec.slice(0, sep))
                 ,   id  = spec.slice(sep+1)
                 ;
-                return new LootTableEntry(p, Item.lookupOrSpeciate(id));
+                return new LootTableEntry(p, tanks.data.items[id]);
             });
         
         NewLootTable.instance = new NewLootTable();
index 85e62a7..ac4787c 100644 (file)
@@ -271,7 +271,7 @@ Unit.subclass('Tank', {
     
     
     getTurretLoc : function getTurretLoc(){
-        var WIGGLE = 2, pw = this.projectile.fn.width;
+        var WIGGLE = 3, pw = this.projectile.fn.width;
         return this.barrelShape.barrelTipLoc(WIGGLE+pw, true);
     },
     
index c65e8e7..b65df39 100644 (file)
@@ -188,6 +188,8 @@ new evt.Class('Thing', {
         if (c) {
             this.components.remove(c);
             c.removeListener('destroy', this.onComponentDeath);
+            if (c.isShield && this.shields)
+                this.shields.remove(c);
         }
         return this;
     },
index 16220c3..8ea439a 100644 (file)
@@ -77,7 +77,7 @@ Thing.subclass('Unit', {
         
         // Additional space on each side which must be clear around the
         // shot to ensure we don't shoot ourself in the foot (literally)
-        var WIGGLE = 2
+        var WIGGLE = 3
         ,   Projectile = this.projectile
         ,   pw2 = Projectile.fn.width/2, ph2 = Projectile.fn.height/2