Skip to content
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

Allow mods to change martial art styles / techniques / buffs #14838

Merged
merged 17 commits into from Jan 16, 2016

Conversation

Projects
None yet
3 participants
@BevapDin
Copy link
Contributor

commented Jan 13, 2016

One can now edit those objects within a mod, for example adding/removing techniques, buffs, compatible weapons... It uses the generic_factory to store/load techniques, styles and buffs and uses the optional and mandatory helper functions when loading those objects.

Example:

{
    "type": "martial_art",
    "id": "style_boxing",
    "edit-mode": "modify",
    "name": "Advanced boxing",
    "remove:static_buffs": [ "boxing_static" ],
    "add:static_buffs": [
        {
            "id" : "boxing_static_other",
            "name" : "Other Boxing",
            "more values" : "for ma_buff here..."
        }
    ],
    "add:techniques" : [ "PRECISE" ],
    "remove:techniques" : [ "tec_boxing_rapid", "tec_boxing_counter" ],
    "//": "override the weapon list with an empty one to erase them all",
    "weapons" : []
}

This changes the vectors of ma_buff in martialart to be vectors of ma_buff ids. Previously the ma_buff objects were loaded and stored in a global map and in the martialart object (as copy). Now each buff is stored once in the global map. Styles may share the same buff, only one style needs to define the it, the others may only list its id.

Currently buffs can only be loaded from within the martial art style, and not as a separate object. Considering that buffs are usually specify to the style anyway, this is probably not a big problem. However, editing buffs is a bit more complicated. One has to "edit" the containing style:

{
    "type": "martial_art",
    "id": "...",
    "edit-mode": "modify",
    "name": "Advanced boxing",
    "//": "removing happens before adding and is here only to prevent adding the buff again",
    "remove:static_buffs": [ "boxing_static" ],
    "add:static_buffs": [
        {
            "//" : "This edits the existing buff!",
            "id" : "boxing_static",
            "edit-mode": "modify",
            "name" : "Other Boxing buff",
        }
    ]
}

69fd23e should fix #14817 by adding an overload that does not require the default value and thereby gets rid of the {}.


@chaosvolt The Arcana mod contains some styles, I changed them to override the existing ones. I suspect they only do a few minor changed (add weapon?), if so, you could make them simpler:

{
    "type" : "martial_art",
    "id" : "style_niten",
    "edit-mode" : "modify",
    "add:weapons" : [
        "bloodscourge",
        "scourge_staff"
    ]
}

Similar works for the buffs ("add:static_buffs").

BevapDin added some commits Jan 13, 2016

Fix enum_flags_reader:
Must inherit public to work properly.
Add dummy throw statement to avoid warning about missing return statement.
Change generic_typed_reader to work better with any kind of JSON entity:
Replaces the `convert` function with a `get_next` function. That function now has to read the value from the JSON stream itself (previously it was given a string that had already been loaded from JSON).

This makes it much more flexible as it can be used to load any kind of object from the stream.
Change `martialart` to only store ma_buff ids, not full ma_buff objects.
Note that copies of the ma_buff objects were stored in a global map anyway. Now this global map is the only place where they are stored.
Remove load_buff
Move its content to where it was used.
@chaosvolt

This comment has been minimized.

Copy link
Contributor

commented Jan 13, 2016

Ah nice, thank you. Yeah, all I did for Arcana mod was add the weapons to the styles. I was also pondering whether any weapons in Medieval mod would fit in existing styles, so I assume this PR would allow for that option without conflicts, if I did so. o.o

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jan 13, 2016

@chaosvolt

This comment has been minimized.

Copy link
Contributor

commented Jan 14, 2016

Hmm. There are still uses for this even in official mods, as has already been demonstrated.

@BevapDin

This comment has been minimized.

Copy link
Contributor Author

commented Jan 14, 2016

A side note to the process as a whole, 'core' mods should only allow the
'create' label.

Just to clarify this: I assume core mods means "mod-type": "CORE". Currently we don't have any any of those.

I don't understand the need for such a restriction. It may not even work in all circumstances, for example if a new item from a core mod needs to be added to a technique. This would require modifying an existing technique object.

@chaosvolt

This comment has been minimized.

Copy link
Contributor

commented Jan 14, 2016

Huh. I was gonna say, what else could Kevin mean by core? I assumed he meant mods that come with the builds, which is supported by your statement that no mods use that mod type.

And since competent use of the modify labels would allow for reduced potential for mod conflict, this sounds like a pointless restriction.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jan 14, 2016

@chaosvolt

This comment has been minimized.

Copy link
Contributor

commented Jan 14, 2016

Ah, that explains it. Sorry. ^^"

@kevingranade kevingranade merged commit 797e295 into CleverRaven:master Jan 16, 2016

1 check passed

default
Details

@BevapDin BevapDin deleted the BevapDin:wab branch Jan 16, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.