Skip to content

Commit

Permalink
Merge pull request #586 from uspgamedev/feature/drop-stash
Browse files Browse the repository at this point in the history
Remove stash mechanic
  • Loading branch information
aki-cat authored Dec 27, 2017
2 parents 08df7f4 + 47f72d5 commit 38d1877
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 64 deletions.
2 changes: 1 addition & 1 deletion game/domain/definitions/colors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ COLORS.VALID = {0x00, 0x7b, 0xff}
COLORS.SUCCESS = {0x33, 0xAA, 0x3F}

COLORS.STASH = {0x41, 0x6e, 0x8e}
COLORS.USE = {0xa3, 0x78, 0x71}
COLORS.PLAY = {0xa3, 0x78, 0x71}

COLORS.COR = {0xbe, 0x76, 0x3a}
COLORS.ARC = {0x6e, 0x60, 0xaa}
Expand Down
5 changes: 4 additions & 1 deletion game/domain/maneuver/draw_new_hand.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ end

function DRAWHAND.validate(actor, params)
return not actor:isBufferEmpty()
and actor:isHandEmpty()
and actor:getPP() >= DEFS.ACTION.NEW_HAND_COST
end

function DRAWHAND.perform(actor, params)
actor:spendPP(DEFS.ACTION.NEW_HAND_COST)
while not actor:isHandEmpty() do
local card = actor:removeHandCard(1)
actor:addCardToBackbuffer(card)
end
for i = 1, DEFS.HAND_LIMIT do
actor:drawCard()
end
Expand Down
31 changes: 0 additions & 31 deletions game/domain/maneuver/stash_card.lua

This file was deleted.

3 changes: 0 additions & 3 deletions game/gamestates/action_menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ end
function state:enter(_, route)

local player = route.getControlledActor()
local action = 'draw_new_hand'
if player:getHandSize() > 0 then action = 'play_card' end
_menu_view:setCardAction(action)
_menu_view:open(_last_focus, player)

end
Expand Down
14 changes: 3 additions & 11 deletions game/gamestates/user_turn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ function state:update(dt)
elseif INPUT.wasActionPressed('SPECIAL') then
_startTask(DEFS.ACTION.USE_SIGNATURE)
elseif INPUT.wasActionPressed('ACTION_1') then
if _route.getControlledActor():isHandEmpty() then
_startTask(DEFS.ACTION.DRAW_NEW_HAND)
else
_startTask(DEFS.ACTION.PLAY_CARD)
end
_startTask(DEFS.ACTION.PLAY_CARD)
elseif INPUT.wasActionPressed('ACTION_2') then
_startTask(DEFS.ACTION.ACTIVATE_WIDGET)
elseif INPUT.wasActionPressed('ACTION_3') then
Expand Down Expand Up @@ -231,23 +227,19 @@ _ACTION[DEFS.ACTION.ACTIVATE_WIDGET] = function()
end

_ACTION[DEFS.ACTION.DRAW_NEW_HAND] = function()
if _route.getControlledActor():isHandEmpty() then
_useAction(DEFS.ACTION.DRAW_NEW_HAND)
end
_useAction(DEFS.ACTION.DRAW_NEW_HAND)
end

_ACTION[DEFS.ACTION.PLAY_CARD] = function()
if #_view.hand.hand > 0 then
SWITCHER.push(GS.CARD_SELECT, _route, _view)
local args = coroutine.yield(_task)
if args.chose_a_card then
if args.action_type == 'use' then
if args.action_type == 'play' then
if _useAction(DEFS.ACTION.PLAY_CARD,
{ card_index = args.card_index }) then
Signal.emit("actor_used_card", _route.getControlledActor(), index)
end
elseif args.action_type == 'stash' then
_useAction(DEFS.ACTION.STASH_CARD, { card_index = args.card_index })
end
end
end
Expand Down
7 changes: 1 addition & 6 deletions game/view/actionmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local _W, _H
local _ANGLE = math.pi/4
local _RADIUS = 196
local _ACTIONS = {
'interact', 'use_signature', 'activate_widget', 'draw_new_hand',
'interact', 'use_signature', 'activate_widget', 'play_card', 'draw_new_hand',
'consume_cards_from_buffer', 'receive_pack', 'idle',
interact = "Interact",
use_signature = "Signature Ability",
Expand All @@ -27,7 +27,6 @@ local _TWEEN = {
TEXT = "__TEXT__",
SWITCH = "__SWITCH__",
}
local _DRAWHAND = 4

-- LOCAL VARIABLES -------------------------------------------------------------

Expand Down Expand Up @@ -58,10 +57,6 @@ function ActionMenu:init()

end

function ActionMenu:setCardAction(action_name)
_ACTIONS[_DRAWHAND] = action_name
end

function ActionMenu:showLabel()
local len = #_ACTIONS[_ACTIONS[self.current]]
self.text = 0
Expand Down
17 changes: 6 additions & 11 deletions game/view/hand.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local _WIDTH, _HEIGHT
local _F_NAME = "Title" --Font name
local _F_SIZE = 24 --Font size
local _ACTION_TYPES = {
'use', 'stash',
'play',
}

local _font
Expand Down Expand Up @@ -74,11 +74,8 @@ function HandView:activate()
self.action_type = 1
self:removeTimer("start", MAIN_TIMER)
self:removeTimer("end", MAIN_TIMER)
self:addTimer("start", MAIN_TIMER, "tween",
0.2,
self,
{ y = self.initial_y - CARD.getHeight() },
'out-back')
self:addTimer("start", MAIN_TIMER, "tween", 0.2, self,
{ y = self.initial_y - CARD.getHeight() }, 'out-back')
end

function HandView:deactivate()
Expand All @@ -88,11 +85,8 @@ function HandView:deactivate()
self:removeTimer("start", MAIN_TIMER)
self:removeTimer("end", MAIN_TIMER)

self:addTimer("end", MAIN_TIMER, "tween",
0.2,
self,
{y = self.initial_y},
'out-back')
self:addTimer("end", MAIN_TIMER, "tween", 0.2, self, {y = self.initial_y},
'out-back')
end

function HandView:draw()
Expand Down Expand Up @@ -162,3 +156,4 @@ function HandView:reset()
end

return HandView

0 comments on commit 38d1877

Please sign in to comment.