start of normal ship upgrades
todo: thrust upgrade
This commit is contained in:
		| @@ -1068,6 +1068,62 @@ player = mknew(ship_m.new{ | ||||
|  end, | ||||
| }) | ||||
|  | ||||
| function player:small_upgrade_opts() | ||||
|  local cdr, pr = (self.shieldcooldown - 0x0.000f) / 8, (self.shieldpenalty - 0x0.003c) / 9 | ||||
|  if (cdr == 0 and self.shieldcooldown > 0x0.000f) cdr = 0x0.0001 | ||||
|  if (pr == 0 and self.shieldpenalty > 0x0.003c) pr = 0x0.0001 | ||||
|  | ||||
|  local ret = {{ | ||||
|   icon=1, | ||||
|   hdr="hull", | ||||
|   body=[[    armor | ||||
|  | ||||
|     +2 hp]], | ||||
|   action=function() | ||||
|    self.maxhp += 2 | ||||
|    self.hp += 2 | ||||
|   end, | ||||
|  },{ | ||||
|   icon=1,  -- todo: icon | ||||
|   hdr="shield", | ||||
|   body=[[  capacity | ||||
|  | ||||
|     +1 hp]], | ||||
|   action=function() | ||||
|    self.maxshield += 1 | ||||
|    self.shield += 1 | ||||
|   end, | ||||
|  }} | ||||
|  | ||||
|  if cdr > 0 then | ||||
|   add(ret, { | ||||
|    icon = 1, --todo: icon | ||||
|    hdr = "shield", | ||||
|    body=[[charge rate | ||||
|   | ||||
|   ]] .. tostr(ceil(100 * cdr / self.shieldcooldown)) .. "% faster", | ||||
|    action = function() | ||||
|     self.shieldcooldown -= cdr | ||||
|    end | ||||
|   }) | ||||
|  end | ||||
|  | ||||
|  if pr > 0 then | ||||
|   add(ret, { | ||||
|    icon = 1, --todo: icon | ||||
|    hdr = "shield", | ||||
|    body=[[disruption | ||||
|   | ||||
|   ]] .. tostr(ceil(100 * pr / self.shieldpenalty)) .. "% shorter", | ||||
|    action = function() | ||||
|     self.shieldpenalty -= pr | ||||
|    end | ||||
|   }) | ||||
|  end | ||||
|  | ||||
|  return ret | ||||
| end | ||||
|  | ||||
| frownie = mknew(ship_m.new{ | ||||
|  --shape | ||||
|  sprite = 3, --index of ship sprite | ||||
| @@ -1705,18 +1761,8 @@ end | ||||
|  | ||||
| -- ordinary upgrades | ||||
| function small_opts() | ||||
|  return {{ | ||||
|   icon=1, | ||||
|   hdr="placeholder", | ||||
|   body="placeholder", | ||||
|   action = function() end, | ||||
|  }, | ||||
|  { | ||||
|   icon=1, | ||||
|   hdr="placeholder", | ||||
|   body="placeholder", | ||||
|   action = function() end, | ||||
|  }} | ||||
|  -- todo: include gun opts | ||||
|  return pick(primary_ship:small_upgrade_opts(), 2) | ||||
| end | ||||
|  | ||||
| -->8 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user