Commit graph

3873 commits

Author SHA1 Message Date
BattleJenkins
d0ba768fdb Change to inventory
Inventory command now outputs a single line when inventory is completely empty rather than two empty tables.
2017-04-17 08:31:01 +02:00
BattleJenkins
86f42228f3 Typo fix
Fixed a weird autocomplete-induced typo.
2017-04-17 08:31:01 +02:00
BattleJenkins
12ff57d883 Typo fix
Typoed 'Superuser' as 'Suuperuser'.
2017-04-17 08:31:01 +02:00
BattleJenkins
17f9a06a68 Provided example and fixed bugs
Added an example of use to the module descriptions, as well as fixed a couple of bugs where the at_get() hook wasn't functioning right and clothing with custom wear styles didn't appear correctly.
2017-04-17 08:31:01 +02:00
BattleJenkins
e7f0149bf8 Adds new 'clothing' contrib module
Adds a new contrib module, providing a system for wearable clothing objects that are appended to one's description. From the module itself:

Items of clothing can be used to cover other items, and many options are provided to define your own clothing types and their limits and behaviors. For example, to have undergarments automatically covered by outerwear, or to put a limit on the number of each type of item
that can be worn. Characters can also specify the style of wear for their clothing - I.E. to wear a scarf 'tied into a tight knot around the neck' or 'draped loosely across the shoulders' - to add an easy avenue of customization. The system as-is is fairly freeform - you can cover any garment with almost any other, for example - but it can easily be made more restrictive, and can even be tied into a system for armor or other equipment.

The unit tests have not been put in for this module yet, but I thought I would share it first to get people's thoughts!
2017-04-17 08:31:01 +02:00
Griatch
a9bee74b37 Some minor pep8 fixes and refactoring. 2017-04-11 08:35:30 +02:00
Griatch
63f4f04d77 Add a short description in the contrib README index. 2017-04-08 19:34:43 +02:00
Griatch
59f491eab4 Some minor adjustments for pep8. 2017-04-08 19:30:46 +02:00
BattleJenkins
005923ee72 Stop the turn handler script at the end of tests
Put in a line of code to stop the turn handler script when the tests are completed, as I think the script lingering and attempting to iterate causes problems with the Travis build.
2017-04-08 19:30:46 +02:00
BattleJenkins
6f565be81e Added turn handler script methods to tests
I added all of the turn handler script's methods to the unit tests (excluding at_creation, at_repeat, and at_stop) - so I think with the exception of those, my module is now fully covered by unit tests!
2017-04-08 19:30:46 +02:00
BattleJenkins
96ccfde9de Added tests for combat functions
All the tests are in for the combat functions! I think I just have to test the turn handler script's methods, and then I'll have full coverage.
2017-04-08 19:30:46 +02:00
BattleJenkins
32dbe4b396 Added kwargs to resolve_attack
Lets you pass values for attack and defense rolls, making it easier to test and extend.
2017-04-08 19:30:46 +02:00
BattleJenkins
822a17ba63 Added turnbattle command tests
Added unit tests for the combat commands in the new 'turnbattle.py' contrib module.
2017-04-08 19:30:46 +02:00
BattleJenkins
334eaf6929 Slight tweak to CmdAttack
Changed the order of the code in CmdAttack, so that it does not try to search for a target until it's established that it's a valid time to attack. This is so it doesn't raise a 'not found' error message along with the other error messages given.
2017-04-08 19:30:46 +02:00
BattleJenkins
2b0d657314 Better combat help + tweak to combat cleanup
With the help of Cloud_Keeper and vincent_lg in chat, I made the combat help command work much better - it doesn't copy swaths of code from the original help command anymore, and instead simply calls the default help with super() when the conditions for combat help aren't met.

I also moved a line from combat cleanup to the turn handler script, since combat cleanup is called when a character is initialized in combat and could remove the needed reference to the turn handler on the room prematurely, resulting in various errors if more than one fighter joined a fight in progress.
2017-04-08 19:30:46 +02:00
BattleJenkins
4e2a927bb4 Properly implemented joining a fight in progress
Some of the code for joining a fight in progress was imported from my project, The World of Cool Battles, but was not implemented completely. The turn handler script now properly puts a reference to itself in the current fight's room, and joining a combat in progress that one isn't already a part of now works properly.
2017-04-08 19:30:46 +02:00
BattleJenkins
4b113cb6c8 Added combat help, fixed oversight in CmdFight
Added a new command, 'CmdCombatHelp', which inherits from the default help command. Its behavior is identical to the normal 'help' command, except that it'll return a short list of combat commands when used in combat with no arguments. If there's a better way to implement this functionality, let me know, since it did involve copy-pasting a huge chunk of code from the Help command just to change one thing!

I also fixed a glaring oversight where using the 'fight' command while already in a fight would start a second fight.
2017-04-08 19:30:46 +02:00
BattleJenkins
fba536e979 Battle commands merged into command set
I merged all the battle commands into a command set together, which makes the module easier to install. The installation instructions have been changed to reflect this.
2017-04-08 19:30:46 +02:00
BattleJenkins
9073b688a6 Fixed log error + bug with timeout
Reworked the way the turn timeout countdown works - it's now less precise but also no longer gives errors. There may be a problem in the Evennia codebase with the default script object's force_repeat() method, but I was unable to figure out what.
2017-04-08 19:30:46 +02:00
BattleJenkins
de21883717 Fixed at_before_move() hook on player
Fixed some erroneous code in the at_before_move() hook that I must have forgotten to test properly. It now works as intended.
2017-04-08 19:30:46 +02:00
BattleJenkins
0606f2b0d8 Updated more documentation to standard
Moved docstrings in the middle of code to the 'Notes:' sections of their relevant functions, and added a missing 'Args:' section.
2017-04-08 19:30:46 +02:00
BattleJenkins
c1cbf0420c Minor tweaks
Fixed the header for the character code section, now that the command set is gone. Also, I forgot to mention, last commit I also fixed a bug where the timer wouldn't give a full 30 seconds for each characters turn if the turn progressed mid-interval.
2017-04-08 19:30:46 +02:00
BattleJenkins
9e6627aabd New functions + Change install method
Created a number of new functions for redundant code, including to initialize characters for combat and spending actions - also changed the suggested method of import, having the user import and add the commands. Adding the command set to BattleCharacter at creation was not persistent across reloads.
2017-04-08 19:30:46 +02:00
BattleJenkins
4e3b59e486 Made turn handler script more efficient
It turns out that changing the turn handler script to react to turn-ending commands instead of check for the end of the turn every single second was actually super easy. The script's interval has been increased from 1 second to 10 seconds, so it should fire off ten times less often now, AND instantly cycle the turn once a player has used all their actions.
2017-04-08 19:30:46 +02:00
BattleJenkins
49cf1220a6 Restore minor fixes
Restores some minor fixes I committed and accidentally reverted when I failed to update my local copy of the module. Note to self: start actually using GitHub correctly.
2017-04-08 19:30:46 +02:00
BattleJenkins
8849366ae9 Re-organized and more thoroughly documented
Implemented most of Griatch's requested changes, including documentation of every class and function, adherence to Google and Evennia's style guides, re-ordering of methods to show them defined before they are used, and a less intrusive install process. Tested before committing and found to function the same way as before. More changes to come, particularly to rework the turn handler script to be more efficient.
2017-04-08 19:30:46 +02:00
BattleJenkins
a070ee1971 Typo fix & Minor bugfix
Fixed a typo and accounted for a rare bug where the turn handler may skip forward two turns if a player acts the same second they would time out.
2017-04-08 19:30:46 +02:00
BattleJenkins
fab0403408 Added contrib module for turn-based battle system
This adds a new contrib file, a module that provides a simple framework for a tabletop style turn based battle system. From the module itself:

This is a framework for a simple turn-based combat system, similar
to those used in D&D-style tabletop role playing games. It allows
any character to start a fight in a room, at which point initiative
is rolled and a turn order is established. Each participant in combat
has a limited time to decide their action for that turn (30 seconds by
default), and combat progresses through the turn order, looping through
the participants until the fight ends.

Only simple rolls for attacking are implemented here, but this system
is easily extensible and can be used as the foundation for implementing
the rules from your turn-based tabletop game of choice or making your
own battle system.
2017-04-08 19:30:46 +02:00
BlauFeuer
f8b279d7bb Adjust docstring to resolve #1300
Also realigns code indent to multiple of 4 after `# ` is removed to uncomment
2017-04-06 19:12:40 -04:00
Vincent Le Goff
7ddcae9d32 Add automatic escaping of color codes in the EvEditor 2017-04-04 11:37:36 -07:00
BlauFeuer
7010f998f1 Fold long lines, PEP 8, comparision to None
+Indent, comment and typo edits
2017-04-01 14:55:02 +02:00
BlauFeuer
684f163fd7 Fold long lines, PEP 8 whitespace
Keeping lines under 120 characters long, adjusting whitepace for closer PEP 8 compliance.
2017-04-01 14:51:25 +02:00
Griatch
c62f701626 Remove an extra quote marker typo. 2017-04-01 14:44:46 +02:00
BlauFeuer
3fdd7e0907 PEP 8, whitespace, LGTM, typo fixes 2017-04-01 14:44:46 +02:00
Griatch
4aba1b59b3 Add a brief mention of the superuser bypassing the locks of the simpledoor contrib. Resolves #1269. 2017-03-30 22:04:54 +02:00
BlauFeuer
6133280154 Explict bool return for move_to, typo fix 2017-03-30 01:27:34 -04:00
Vincent Le Goff
3811c074c6 Replace {character} by {object} in mapping of announce_move_* 2017-03-29 22:11:25 +02:00
Vincent Le Goff
f1d34a28aa Add additional mapping to announce_move_* hooks 2017-03-29 22:11:25 +02:00
Vincent Le Goff
4f41582127 Update Object.announce_move_* to take advantage of mapping 2017-03-29 22:11:25 +02:00
Griatch
d811d7577e Fix unittest compliance. 2017-03-29 22:00:27 +02:00
Griatch
f6e230f1a6 Change text optional kwarg type name to lowercase to match all other communications variables. Expand msg_contents to handle a tuple. 2017-03-29 21:50:51 +02:00
CloudKeeper1
c12306ff72 Adjustments to argument capitalisation.
Adjustments to argument capitalisation.
2017-03-29 18:16:19 +02:00
CloudKeeper1
4bbba76155 msg_contents doesn't take the text keyword in arguments.
Adjusted code so it works now...
2017-03-29 18:16:19 +02:00
CloudKeeper1
344a724479 Changed option entry to msg output kwarg.
Griatch - "That way it can still be parsed by the protocol if so needed, but it is also be passed on so the client can do custom stuff with it if it can."
2017-03-29 18:16:19 +02:00
CloudKeeper1
375cd7cecb Changed kwarg to options entry
Due to the set up of sessionhandler.clean_senddata the information is more appropriately stored in options.
2017-03-29 18:16:19 +02:00
CloudKeeper1
6cfbec83f1 Inclusion of type kwarg for common communications
Including a type kwarg for the say, whisper and pose commands allows the receivers of those messages to treat them differently depending on type. IMO This is a wide enough concern that it goes beyond a game specific requirement.
2017-03-29 18:16:19 +02:00
Eldritch Semblance
6224f90f74 Changed unit test's expected text output 2017-03-29 02:57:09 +00:00
Eldritch Semblance
534f4bcbe1 Removed insulting no mail message 2017-03-29 02:52:46 +00:00
Eldritch Semblance
a4e2744821 check if ooc or puppeting before finding player object 2017-03-29 02:46:44 +00:00
Griatch
21e72e416c Fix error in more edge calculation when using client with SCREENWIDTH=0. Resolves #1257. 2017-03-27 22:40:40 +02:00