ScummVM API documentation
Ultima::Ultima1::Logic::Logic Class Reference

#include <logic.h>

Inheritance diagram for Ultima::Ultima1::Logic::Logic:
Ultima::Ultima1::Logic::CityCastleLogic Ultima::Ultima1::Logic::DirectionLogic Ultima::Ultima1::Logic::DungeonLogic Ultima::Ultima1::Logic::MondainLogic Ultima::Ultima1::Logic::OverworldLogic Ultima::Ultima1::Logic::SpaceLogic Ultima::Ultima1::Logic::CastleLogic Ultima::Ultima1::Logic::CityLogic Ultima::Ultima1::Logic::SpaceCockpitLogic Ultima::Ultima1::Logic::SpaceMapLogic

Public Member Functions

virtual void action (int action)
 
virtual void keypress (Common::KeyCode keycode)
 
virtual void entering ()
 
virtual void tick ()
 
virtual bool isPersisted () const
 

Protected Member Functions

void writeString (const Common::String &msg)
 
void writeString (const char *format,...)
 
void resetLine ()
 
void prompt ()
 
void playFX (int num)
 
int getRandomNumber (int minNumber, int maxNumber)
 
int getRandomNumber (int maxNumber)
 
void redrawMap ()
 
void showAttackTile (int x, int y, int tileId)
 
void redrawStats ()
 
void giveTreasure (int coins, int nameLen)
 
void combat (Data::Direction direction, int effect)
 
virtual bool attack (Data::Direction dir)
 
virtual void endOfTurn ()
 
virtual void updateCreatures ()
 
virtual void castSpellAttack (Data::Direction)
 
virtual void damage (Data::Direction, int, int, int, int, int)
 
virtual bool board ()
 
virtual bool cast ()
 
virtual bool climb ()
 
virtual bool drop ()
 
virtual bool enter ()
 
virtual bool fire ()
 
virtual bool get ()
 
virtual bool hyperjump ()
 
virtual bool inform ()
 
virtual bool noise ()
 
virtual bool open ()
 
virtual bool quit ()
 
virtual bool ready ()
 
virtual bool steal ()
 
virtual bool transact ()
 
virtual bool unlock ()
 
virtual bool view ()
 
virtual bool xit ()
 
virtual bool zstats ()
 
virtual bool move (Data::Direction)
 
virtual bool pass ()
 

Protected Attributes

int _weaponDamageScale = 8
 

Detailed Description

Base class for gameplay handling logic used by the Commands class to respond to player actions or other miscellaneous keypresses.

Member Function Documentation

◆ writeString()

void Ultima::Ultima1::Logic::Logic::writeString ( const Common::String &  msg)
protected

Dispatches some text to be shown in the Commands window

◆ resetLine()

void Ultima::Ultima1::Logic::Logic::resetLine ( )
protected

Clears the current line of the Commands window, ready for it to be overwritten

◆ prompt()

void Ultima::Ultima1::Logic::Logic::prompt ( )
protected

Triggers a prompt display in the Commands window

◆ playFX()

void Ultima::Ultima1::Logic::Logic::playFX ( int  num)
protected

Play a sound effect

◆ getRandomNumber()

int Ultima::Ultima1::Logic::Logic::getRandomNumber ( int  minNumber,
int  maxNumber 
)
protected

Returns a random number

◆ redrawMap()

void Ultima::Ultima1::Logic::Logic::redrawMap ( )
protected

Signal the map to redraw

◆ showAttackTile()

void Ultima::Ultima1::Logic::Logic::showAttackTile ( int  x,
int  y,
int  tileId 
)
protected

Has the currently focused map view briefly flash a tile on-screen at a given map position - e.g. a projectile flying towards the player, or a hit flash - pausing before returning. Used for combat animations; see AttackTileMessage

◆ redrawStats()

void Ultima::Ultima1::Logic::Logic::redrawStats ( )
protected

Signal the stats to redraw

◆ giveTreasure()

void Ultima::Ultima1::Logic::Logic::giveTreasure ( int  coins,
int  nameLen 
)
protected

Adds coins to the player's purse, capped at 9999, and lists the copper, silver and gold found. When nameLen is the length of a just-shown monster name, the amounts continue on from it; zero means they start a fresh line

◆ combat()

void Ultima::Ultima1::Logic::Logic::combat ( Data::Direction  direction,
int  effect 
)
protected

Triggers combat action

◆ attack()

virtual bool Ultima::Ultima1::Logic::Logic::attack ( Data::Direction  dir)
protectedvirtual

◆ endOfTurn()

virtual void Ultima::Ultima1::Logic::Logic::endOfTurn ( )
protectedvirtual

Handles end of turn logic

Reimplemented in Ultima::Ultima1::Logic::MondainLogic, and Ultima::Ultima1::Logic::SpaceLogic.

◆ updateCreatures()

virtual void Ultima::Ultima1::Logic::Logic::updateCreatures ( )
inlineprotectedvirtual

◆ castSpellAttack()

virtual void Ultima::Ultima1::Logic::Logic::castSpellAttack ( Data::Direction  )
inlineprotectedvirtual

Cast spell direction chosen for overworld spells

Reimplemented in Ultima::Ultima1::Logic::MondainLogic, and Ultima::Ultima1::Logic::OverworldLogic.

◆ damage()

virtual void Ultima::Ultima1::Logic::Logic::damage ( Data::Direction  ,
int  ,
int  ,
int  ,
int  ,
int   
)
inlineprotectedvirtual

Resolves a weapon/cannon-fire/spell attack in a given direction - rolls to hit, then applies damage or kills whatever's found there. The city/castle half (CityCastleLogic) attacks an NPC widget; the overworld half (OverworldLogic) attacks a monster entity - dungeons have their own separate attack handling and don't use this

Parameters
dirDirection to attack in
effectNumSound effect Id to play on a successful hit
maxDistanceHow far away a target can be and still be hit
strikeAmount of damage to inflict
hitChance1-100 threshold a to-hit roll must be under
tileIdTile Id shown for the weapon/projectile effect

Reimplemented in Ultima::Ultima1::Logic::CityCastleLogic, Ultima::Ultima1::Logic::MondainLogic, and Ultima::Ultima1::Logic::OverworldLogic.

◆ board()

virtual bool Ultima::Ultima1::Logic::Logic::board ( )
protectedvirtual

◆ cast()

virtual bool Ultima::Ultima1::Logic::Logic::cast ( )
protectedvirtual

◆ climb()

virtual bool Ultima::Ultima1::Logic::Logic::climb ( )
protectedvirtual

◆ drop()

virtual bool Ultima::Ultima1::Logic::Logic::drop ( )
protectedvirtual

◆ enter()

virtual bool Ultima::Ultima1::Logic::Logic::enter ( )
protectedvirtual

◆ fire()

virtual bool Ultima::Ultima1::Logic::Logic::fire ( )
protectedvirtual

◆ get()

virtual bool Ultima::Ultima1::Logic::Logic::get ( )
protectedvirtual

◆ hyperjump()

virtual bool Ultima::Ultima1::Logic::Logic::hyperjump ( )
protectedvirtual

◆ inform()

virtual bool Ultima::Ultima1::Logic::Logic::inform ( )
protectedvirtual

◆ open()

virtual bool Ultima::Ultima1::Logic::Logic::open ( )
protectedvirtual

◆ quit()

virtual bool Ultima::Ultima1::Logic::Logic::quit ( )
protectedvirtual

◆ steal()

virtual bool Ultima::Ultima1::Logic::Logic::steal ( )
protectedvirtual

◆ transact()

virtual bool Ultima::Ultima1::Logic::Logic::transact ( )
protectedvirtual

◆ unlock()

virtual bool Ultima::Ultima1::Logic::Logic::unlock ( )
protectedvirtual

◆ xit()

virtual bool Ultima::Ultima1::Logic::Logic::xit ( )
protectedvirtual

◆ move()

virtual bool Ultima::Ultima1::Logic::Logic::move ( Data::Direction  )
inlineprotectedvirtual

◆ keypress()

virtual void Ultima::Ultima1::Logic::Logic::keypress ( Common::KeyCode  keycode)
virtual

◆ entering()

virtual void Ultima::Ultima1::Logic::Logic::entering ( )
inlinevirtual

◆ tick()

virtual void Ultima::Ultima1::Logic::Logic::tick ( )
inlinevirtual

Called once per game frame for any logic updates

Reimplemented in Ultima::Ultima1::Logic::MondainLogic, Ultima::Ultima1::Logic::SpaceCockpitLogic, and Ultima::Ultima1::Logic::SpaceMapLogic.

◆ isPersisted()

virtual bool Ultima::Ultima1::Logic::Logic::isPersisted ( ) const
inlinevirtual

Returns whether this logic's map can be changed by the player, so its contents have to be kept in savegames

Reimplemented in Ultima::Ultima1::Logic::CityCastleLogic, and Ultima::Ultima1::Logic::MondainLogic.


The documentation for this class was generated from the following file: