Couldn't fit this in elsewhere. It needs overlooking. most of it stolen from current attack code

the attack phase as I have it now. tweak it endlessly please.

got a target?
if no, update vision (sort attackers after threat), pick the most dangerous looking guy, auto attack (setting)
check which weapon(s) to attack with
count up weapon penalties
two handed style
check skills and abilities, perks etc
(level of skill) = (penalty main/off hand)
no level = some / great
low level = less / alot
medium level = little / some
high level = no / little
master = no / almost none
one weapon style
if second weapon is used as a shield then not so much penalties on the first hand
can you reach?
two weapons.
pick the longest one
weapon distances
melee vs melee = no penalty
melee vs polearm = moderate penalty
melee vs ranged = can't reach, move in (setting)
polearm vs melee = moderate penalty
polearm vs polearm = no penalty
polearm vs ranged = can't reach, move in (setting)
ranged vs melee = great penalty, move out (setting)
ranged vs polearm = moderate penalty
ranged vs ranged = no penalty
calculate threat when moving. A threated spot is when the enemy you are closing in on can attack you
threat dice moving in. success or not
melee = great threat
polearm = much threat
ranged = little threat
threat dice moving away
melee = little threat
polearm = no threat
ranged = no threat
general to hit modifier which adds some sense to hits and misses.
melee = near impossible to miss (unless drunk, effects etc), target can dodge/block/parry instead
polearm = unlikely to miss
ranged = normal to hit
longer ranged (not supported yet) = the further it gets the harder to hit, abilities and skills could be useful, as well as items (magical)
is target aware of combat/you?
if not, surprise him and to_hit modifier is trippled
fatigue check
the more fatigue the harder it will be to hit, there's no limit but you better rest if you start missing in melee combat. Enemy will be notified when a player looks tired (ability to conciel it?)
fatigue taken for attacking
then some extra per "swing", which will make dual weapon fighing easier, but will require some extra fatigue
the heavier you are the more fatigue is taken. Dexterous players use less fatigue.
you should be able to train the limit, but you need to keep training to stay "fit".
general modifier
for spell boosts, skills, abilities etc
size modifier, enemy size vs your size becomes apparent
same size = no modifier
target bigger = more
target small = less
start the attack
roll to_hit dice
two weapons = two separate attacks by default (but simultaniously) this might tire the player out faster so shield/parry with the second weapon wisely.
combo attacks? scissor, round swing, whirlwind and so on. Better off as commands right?
to hit = dice + range mod + general mod + size mod - weapon penalty - weapon range penalty - fatigue penalty
the better you are at combat the less random the dice become?
hit the target
attack with attack dice
attack = rate mod + str mod + general mod - weight mod - fatigue penalty
target is aware
no, free hit, target becomes aware now
add attacker
yes, target defends with defence dice
*UNCLEAR*: defend style, parry/block(with armour/shield)/dodge. They are all quite different and often not equal. setting as now? In that case you need to be able to change it quickly.. and some clever auto picking is needed.
Parry would be good when you are holding an extra weapon you are not attacking with. But you can also parry with your primary weapon if you want. Less chance
Dodge, just step out of the way. depends on what you are carrying, your gear and all kinds of stuff
Block, Take the hit right on and hope it doesn't score anywhere critical. Not very wise if you are not wearing any armour. Extra good if you use a shield, otherwise the hit might damage you some in any case (depending on str of hit and your armour).
defence = dice + dex mod + general mod + armour mod? - weight mod - fatigue penalty (see unlcear above)
attack vs defence
where did you hit.
critical dice
critical = no idea. hit rate - fatigue mod something
if critical, look up effect and apply it
calculate dammage
special dammage?
dammage = base dammage + weapon etc + critical mod + str of hit blah blah
deal dammage
target died?
partial corpse ownership kicks in (setting). If owner is busy corpse is free (example if he start attacking something else immideatly, or leave the room)
who owns the corpse?
point system
dammage dealt percentage = much points in percentage (pets dammage is transfered to pets owner)
killer blow = some points
calculate exp
collect score
store stats (for party use, corpse ownership, stuff like that)
transfer to apropriate places
party stats
exp gained
dammage taken
dammage given
monsters killed
time spent fighting
most are truncated when controller dies?

evaluateCombatStart() Checks if the combat can begin. false if no combattants. todo

evaluateCombatEnd() Checked each round to see if there is any point of having it still rolling on rounds. Does a check if there is any errors for combattants that will not make them able to fight anymore. If so, remove them and continue. return if none is attacking. todo (more states, and combat could be going on even if none is swinging at eachother).

nextRound() Roll in a new round, check initiative, surprice, and give opportunities of attack to anything involved in this combat.

What is the Combat Controller? Where should it be stored? It must be able to support multiple fights within the same room in a wise way. Could be up to the daemon but all messages shouldn't be displayed to everyone in the room (noticeable by people involved in the fight). Necessary for fully supported range.

A living attacks another living. The two livings were not previously in any combat. This includes agressive monsters attacking players some time after the player enters the environment around the monster.

Yes - this is an interesting point... At the time I did the sequence diagrams I was working under the assumption that at the time you notified the combat daemon of your entering combat that you had (or were about to) swung. Thus the opponent should be made aware.

I had not yet worked in the "start combat with this attack" part of it though.

In many cases combat begins with me advancing on you with obvious hostile intent. You could feasibly get the first swing, based on initiative... Surprise also comes into it.

The dotted lines are the returns from the function call. The text beside them is the return type. A void being the type indicating the function call does not return anything. I want them off the diagram. -- FantoM - 22 Jan 2003

The Combat daemon will be the central manager for handling the existence of combat. It will not manage individual fights - these will be delgated to Combat Controller instances. Methods for starting/stopping combat and obtaining a Combat Controller will form the core of this object.

The Combat daemon will be the central manager for handling the existence of combat. It will not manage individual fights - these will be delgated to Combat Controller instances. Methods for starting/stopping combat and obtaining a Combat Controller will form the core of this object.

A combat controller is responsible for managing a fight. This should equate to all the combat between a set of livings in a room, although it is feasible that the combat re-design will support distance attacks between rooms.

Combat controllers will come and go as combat is started and stopped as livings move around rooms.

The Combat daemon will be responsible for assigning a Combat Controller when combat starts, although the room may be able to provide a preferred combat controller description, allowing for rooms in which combat is substantially different from the norm.

A combat controller is responsible for managing a fight. This should equate to all the combat between a set of livings in a room, although it is feasible that the combat re-design will support distance attacks between rooms.

Combat controllers will come and go as combat is started and stopped as livings move around rooms.

The Combat daemon will be responsible for assigning a Combat Controller when combat starts, although the room may be able to provide a preferred combat controller description, allowing for rooms in which combat is substantially different from the norm.

Living objects will contain the code necessary for initiating combat and taking damage.

Methods:

void startCombat( Living target )
This will start combat with the target. Surprise, if any, will go to the attacker, but initiative may cause the target to get first swing.

... halting combat methods ...

... damage taking methods - hitPlayer ? ...

Added:

>>

Combat Daemon

The Combat daemon will be the central manager for handling the existence of combat. It will not manage individual fights - these will be delgated to Combat Controller instances. Methods for starting/stopping combat and obtaining a Combat Controller will form the core of this object.

Methods:

todo ..

Added:

>>

Combat Controller

A combat controller is responsible for managing a fight. This should equate to all the combat between a set of livings in a room, although it is feasible that the combat re-design will support distance attacks between rooms.

Combat controllers will come and go as combat is started and stopped as livings move around rooms.

The Combat daemon will be responsible for assigning a Combat Controller when combat starts, although the room may be able to provide a preferred combat controller description, allowing for rooms in which combat is substantially different from the norm.

Methods:

todo ..

Room

Rooms can provide the Combat daemon with a preferred Combat Controller to be used when combat occurs within the room.

Methods:

string queryPreferredCombatController() This method will not exist in the standard room but will be called by the Combat Daemon each time combat is initiated in the room.

The extraction of combat management code from living objects and insertion into self contained objects will provide us with the ability to centrally manage fights, opening up the possibility of a much more varied and interesting combat system.