-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic monster attacks, take 2: "Library of Attacks" #19702
Conversation
@@ -10,6 +10,7 @@ | |||
#include "sounds.h" | |||
#include "npc.h" | |||
#include "debug.h" | |||
#include <algorithm> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this include
?
|
||
void mattack_actor::load( JsonObject &jo, const std::string &src ) | ||
{ | ||
bool strict = src == "core"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check doesn't work anymore. The core mod is "dda"
.
{ | ||
damage_max_instance = damage_instance::physical( 9, 0, 0, 0 ); | ||
min_mul = 0.5f; | ||
max_mul = 1.0f; | ||
move_cost = 100; | ||
} | ||
|
||
void bite_actor::load( JsonObject &obj ) | ||
void load_if_available( std::string &to, JsonObject &obj, const std::string &id, | ||
const std::string &def ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a reinvented optional( ..., translated_string_reader )
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to get it without generic factory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional()
doesn't depend on it.
I assume this will warrant reporting on #19376 when it is merged, if it changes monster files. @pisskop and @chaosvolt would need to update their mods. |
Eh? Sure, I guess. Wait, JSON API? :V |
See issue mentioned by me above, reporting major JSON changes. |
struct mtype_special_attack { | ||
protected: | ||
// @todo Remove friend | ||
friend class mtype; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mtype
is a struct
.
Should be working now. |
This got pretty giant. Recreating PR instead of reopening #17679 because it got some giant updates.
Contains the generic melee attacks as in #17679 but also a "library of monster attacks" which works as follows:
MonsterGenerator::attack_map
iuse
functionstest_mode
(--check-mods
)For example:
It is also possible to use the array definition (
"special_attacks": [ [ "nibble", 2 ] ]
).EDIT: Added a doc: https://github.com/CleverRaven/Cataclysm-DDA/wiki/Monster-special-attacks