diff options
author | jacopograndi <jak.sk8@hotmail.it> | 2021-09-05 22:36:13 +0200 |
---|---|---|
committer | jacopograndi <jak.sk8@hotmail.it> | 2021-09-05 22:36:13 +0200 |
commit | 728abda9dc6fc8e65c7c0e0240a2e7d61a43a583 (patch) | |
tree | 545187ed3d634792af1082ce021665d3ef4934fc /game/playercontrol.cpp | |
parent | c298eb988874bc2cf3adb39c2532419ec76a24bc (diff) |
tech tostring, all sprites, heal and convert
Diffstat (limited to 'game/playercontrol.cpp')
-rw-r--r-- | game/playercontrol.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/game/playercontrol.cpp b/game/playercontrol.cpp index 23c9f3e..2aa9264 100644 --- a/game/playercontrol.cpp +++ b/game/playercontrol.cpp @@ -28,6 +28,18 @@ void open_unit_menu (Gst &gst, View &view, Fsm &fsm, int p) { view.menu_unit.options.emplace_back("Build", Menu_unit::Opts::build); } + if (gst.ground.heal_targets(gst, ent).size() > 0 + && (gst.info_has_ability(ent.info, "Heal"))) + { + view.menu_unit.options.emplace_back("Heal", + Menu_unit::Opts::heal); + } + if (gst.ground.convert_targets(gst, ent).size() > 0 + && (gst.info_has_ability(ent.info, "Convert"))) + { + view.menu_unit.options.emplace_back("Convert", + Menu_unit::Opts::convert); + } view.menu_unit.options.emplace_back("Done", Menu_unit::Opts::done); } else { @@ -358,6 +370,60 @@ Player_control::Player_control () { } ); fsm.arcs.emplace_back( + menu_unit, opt, Menu_unit::Opts::heal, + [](Gst &gst, View &view, Fsm &fsm, int p) { + Player &player = gst.players[gst.turn]; + view.menu_unit.close(); + Entity &ent = gst.entities[view.selected_entity]; + view.heals = gst.ground.heal_targets(gst, ent); + std::cout << "heal targeting " << p << "\n"; + return target_heal; + } + ); + fsm.arcs.emplace_back( + target_heal, sel_ground, -1, + [](Gst &gst, View &view, Fsm &fsm, int p) { + std::cout << "healed " << p << "\n"; + Entity &atk = gst.entities[view.selected_entity]; + int x = view.cursor_ground % gst.ground.sizex; + int y = view.cursor_ground / gst.ground.sizex; + std::cout << "selg " << x << " " << y << "\n"; + Entity &def = gst.get_at(x, y); + atk.done = true; + gst.heal(atk, def); + view.heals.clear(); + view.selected_entity = -1; + return select; + } + ); + fsm.arcs.emplace_back( + menu_unit, opt, Menu_unit::Opts::convert, + [](Gst &gst, View &view, Fsm &fsm, int p) { + Player &player = gst.players[gst.turn]; + view.menu_unit.close(); + Entity &ent = gst.entities[view.selected_entity]; + view.converts = gst.ground.convert_targets(gst, ent); + std::cout << "convert targeting " << p << "\n"; + return target_convert; + } + ); + fsm.arcs.emplace_back( + target_convert, sel_ground, -1, + [](Gst &gst, View &view, Fsm &fsm, int p) { + std::cout << "converted " << p << "\n"; + Entity &atk = gst.entities[view.selected_entity]; + int x = view.cursor_ground % gst.ground.sizex; + int y = view.cursor_ground / gst.ground.sizex; + std::cout << "selg " << x << " " << y << "\n"; + Entity &def = gst.get_at(x, y); + atk.done = true; + gst.convert(atk, def); + view.converts.clear(); + view.selected_entity = -1; + return select; + } + ); + fsm.arcs.emplace_back( menu_unit, opt, Menu_unit::Opts::done, [](Gst &gst, View &view, Fsm &fsm, int p) { view.menu_unit.close(); |