the state of the (mud) world
I have rudimentary combat working based on a finite state machine.
- Participants are added or removed as combat progresses.
- Turn order is dictated by initiative.
- Initiative is rolled as combatants are added
- Players have a number of actions
- Participants are removed at hp 0
- Combat ends when participant count drops below 2
adding participants
When the user calls the attack command on a target a few things happen:
- from the attack, ensure the target can be attacked
- add a combat turn handler to the room (if one doesn’t exist)
- add the new combatant(s) to combat
If no combat is taking place, then the attack command, with an argument, will add a combat turn handler to the room and add the entity that is doing the attacking and the target that is being attacked.
If combat is ongoing and it’s from a new source that is not in combat, they are added to the existing combat, as well as their target (if their target is not yet in combat.)
Basically, the attack command will make sure that whomever is using it and what or whomever it is being used on are both added to the fight, and if there is no fight, it will create one to which they may be added.
not just players
I have a base type for an attackable mob and several child classes. One such child class is fairly aggressive and will occasionally attack others as they enter the room it occupies.
pvp and pve
Players may attack other plays or npcs, provided that they both hit points remaining and any targeted NPCs have an attackable parent class.
what about co-op
The players must choose to disengage if there are other players in the fight with whom they do not wish to fight. This is a limitation and I haven’t formed a plan to deal with it yet. I’ll deal with it after I have a party system.
attacking
Currently attacking is the only combat action. Engaging in action engages a basic attack. I’m creating additional actions now and adding an action queue that will be spent down once the costs of the action have been paid in in the form of prior actions phases passing.
There are some special attacks which can take multiple actions, have cool downs, and cause the enemy to be “staggered” – it makes them lose some number of actions.
fleeing
Fleeing is an option, it attempts to end the combat for the individual attempting to flee. It can end combat in total if there are only two in combat.
dying
Upon defeat (hp hits zero), the recently deceased is removed from the fight. The fight may end if there is only one or fewer persons left.
Also, the dead are sent to Limbo, no loss of inventory or anything like that yet for players. Haven’t decided on what the penalties should be.
Terms:
- combat turn handler – a script that’s attached to the room where combat is taking place
- Limbo - this is a special room in evennia where anything without a home gets dropped, so it’s also the starting room for new players, I connected it via doorway to an open field in the Tranquil Valley.
Tags
Navigation
updated: 2024-01-07 11:24:54
generated: 2024-10-15
Source