#include <logic.h>
Public Member Functions | |
| virtual void | action (int action) |
| virtual void | keypress (const Graphics::Views::KeypressMessage &msg) |
| virtual void | entering () |
| virtual bool | attack (Data::Direction dir=Data::DIR_UNSPECIFIED) |
| virtual bool | fire (Data::Direction dir=Data::DIR_UNSPECIFIED) |
| virtual bool | steal (Data::Direction dir=Data::DIR_UNSPECIFIED) |
| virtual bool | unlock (Data::Direction dir=Data::DIR_UNSPECIFIED) |
| virtual bool | offer (Data::Direction dir=Data::DIR_UNSPECIFIED) |
| virtual bool | transact (Data::Direction dir=Data::DIR_UNSPECIFIED) |
| void | resolveDirection (Data::Direction dir) |
| virtual void | completeOffer (int) |
| virtual void | completeStatBoost (int) |
| virtual void | tick () |
| bool | eatFood (int amount) |
| void | playerDied (bool showDied=true) |
| void | resumeTurn () |
| bool | trySpendGold (int amount) |
Protected Types | |
| enum class | DirectionPurpose { ATTACK , FIRE , STEAL , UNLOCK , OFFER , TRANSACT } |
Protected Member Functions | |
| void | writeString (const Common::String &msg) |
| void | writeString (const char *format,...) |
| void | prompt () |
| void | alertTownGuards (int extraSlot=-1) |
| void | redrawMap () |
| void | redrawStats () |
| int | getRandomNumber (int minNumber, int maxNumber) |
| int | getRandomNumber (int maxNumber) |
| byte | randByte () |
| void | showAttackTile (int x, int y) |
| void | playFX (Data::SoundEffect fx) |
| virtual void | endOfTurn () |
| virtual void | updateCreatures () |
| virtual bool | move (Data::Direction) |
| virtual bool | board () |
| virtual bool | cast () |
| virtual bool | castSpell (Data::SpellType spell) |
| virtual bool | descend () |
| virtual bool | enter () |
| virtual bool | get () |
| virtual bool | hyper () |
| virtual bool | igniteTorch () |
| virtual bool | jump () |
| virtual bool | klimb () |
| virtual bool | launch () |
| virtual bool | magic () |
| virtual bool | negateTime () |
| virtual bool | pass () |
| virtual bool | quit () |
| virtual bool | ready () |
| virtual bool | view () |
| virtual bool | wearArmor () |
| virtual bool | xit () |
| virtual bool | yell () |
| virtual bool | zstats () |
Protected Attributes | |
| DirectionPurpose | _directionPurpose = DirectionPurpose::ATTACK |
| bool | _monstersSkipTurn = false |
Base class for gameplay handling logic - one virtual method per player command letter, with a default fallback body for each. Concrete subclasses per mode (overworld, city/castle, dungeon, space) override only the commands that differ there.
|
protected |
Dispatches some text to be shown in the Commands window
|
protected |
Triggers a prompt display in the Commands window
|
protected |
Alerts nearby town guards (slots 0-7, plus optionally the specific slot just interacted with) after an attack or theft. A no-op on the overworld (_mapType == 0)
|
protected |
Signal the map to redraw
|
protected |
Signal the stats to redraw
|
protected |
Returns a random number
|
protected |
Returns the next byte from the game's random number generator
|
protected |
Has the currently focused map view briefly flash the attack sprite over a map position - a hit indicator, pausing before returning. See AttackTileMessage
|
protected |
Plays a short PC speaker sound effect
|
protectedvirtual |
Handles end of turn logic
|
inlineprotectedvirtual |
Handles updating creatures/NPCs
Reimplemented in Ultima::Ultima2::Logic::CityCastleLogic, Ultima::Ultima2::Logic::DungeonLogic, and Ultima::Ultima2::Logic::OverworldLogic.
|
protectedvirtual |
Applies the effect of a spell that's just been cast
Reimplemented in Ultima::Ultima2::Logic::DungeonLogic.
|
inlinevirtual |
Reimplemented in Ultima::Ultima2::Logic::DungeonLogic.
| void Ultima::Ultima2::Logic::Logic::resolveDirection | ( | Data::Direction | dir | ) |
Called by the Direction interaction once a direction has been chosen, dispatching to whichever command requested it (see _directionPurpose). Resumes the turn if the command reports it's now complete.
|
inlinevirtual |
Called once a digit has been chosen by the OfferGold interaction
Reimplemented in Ultima::Ultima2::Logic::CityCastleLogic.
|
inlinevirtual |
Called once an attribute has been chosen by the StatBoost interaction (1 to 6, anything else being none of them)
Reimplemented in Ultima::Ultima2::Logic::CityCastleLogic.
|
inlinevirtual |
Called once per game frame for any logic updates
| bool Ultima::Ultima2::Logic::Logic::eatFood | ( | int | amount | ) |
Uses up some food, given in hundredths of a unit, or half that if the option for less hunger is on. Returns false if food ran out
| void Ultima::Ultima2::Logic::Logic::playerDied | ( | bool | showDied = true | ) |
Handles the player dying - clears their resources and returns to the title screen
|
inline |
Resumes end of turn processing after a command deferred it (returned false from action()) to run some sub-interaction first
| bool Ultima::Ultima2::Logic::Logic::trySpendGold | ( | int | amount | ) |
Attempts to deduct gold; prints a failure message and returns false if the player can't afford it. Public since interactions (shop purchases, offerings) call this directly