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

Looting implementation #17

Merged
merged 12 commits into from Jul 22, 2014

Conversation

Projects
None yet
2 participants
@KatrinaHoffert

As described in this forum post. Looting gives and takes resources on death of a unit. This particular implementation allows units to specify what happens when they die: how many resources do they give and how many do they lose. These numbers can be specified as either absolute values or as percentages of their existing resources.

Example:

<parameters>
    <!-- ... -->
    <resources-death>
        <resource name="wood" amount-value="100" loss-value="100" allow-negative="true" />
        <resource name="gold" amount-percentage="10" loss-percentage="10" />
        <resource name="food" amount-value="1" />
    </resources-death>
    <!-- ... -->
</parameters>

As the example shows, we specify a list of resources in a manner akin to the resource cost. The attributes are:

  • amount-value: An absolute amount to give to the killing unit.
  • amount-percentage: Percentage of the killed unit to give to the faction that killed it.
  • loss-value: An absolute amount of resources that are removed from the faction of the killed unit.
  • loss-percentage: Percentage of the resource that are removed from the faction of the killed unit.
  • allow-negative: If true, the faction can go into the negatives if they lose more resources than they have. If false, the resource count won't go below 0.

All combinations of attributes are valid. All default to 0 (except allow-negative, which defaults to false). Values can be negative to inverse their intent (eg, a negative value for loss-value means that the faction of the killed unit gets some resources back).

Possibilities:

  • Implement a werewolf unit that obtains its special "food" by killing units
  • Recouperate small amounts of funds by warfare
  • When destroyed, buildings return some of their resources

Notes:

  • I kind of screwed up this pull request by making it dependent on the starting HP/EP changes. So that pull request must be merged first.

Mike Hoffert and others added some commits Jul 19, 2014

Mike Hoffert
First, basic looting implementation
Only absolute values are obtained for now, no loss.
Mike Hoffert
Added setting to disable going into negatives
After all, how does one loot what the other faction does not have? Still,
could be useful for some places, by forcing the opponent to go into
"debt".
Mike Hoffert
Fixed compilation error
Failed to override ==
Mike Hoffert
Fixing platform inconsistency
It appears that the issue is a Windows problem, with Windows providing
macros for min and max that interfere with using the proper ones defined
in the algorithm header file.
Mike Hoffert
Converted floats to ints
As discussed with Titi, this may prevent some issues with multiplayer
getting out of sync due to different floating point calculations.
Mike Hoffert
Renamed loss-percentage to faction-loss-percentage
Also renamed loss-value accordingly. As discussed with Titi in IRC.

@titiger titiger merged commit fbde1e6 into MegaGlest:develop Jul 22, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

ckorn pushed a commit to ckorn/PlayDeb that referenced this pull request Jan 25, 2015

Christoph Korn
megaglest: 3.11.0-1~getdeb1
  * New upstream version
    - healthbars with a lot of options
    - multi shot / multi-projectiles with different timings,sounds and
    particle systems
    - several camera shake effects
    - new tileset "pine rock"
    - some new maps
    - improve switching settings when connected to a headless server
    - support for team unit sharing
    - team resource sharing
    - tags feature
    - Attack boosts fixed in many ways
    - Attack boosts and upgrades now support upgrading attack speed
    - timed particles and mesh bound particles really work now.
    - unit height independend particle positioning
     ( flat-particle-positions )
    - CPU players multiplier are displayed in debug view
    - You can have non commandable units
    - Units spawned by an attack skill can get an attack command
    - Unit and Splash particles can be speeded up ( accelerated )
    - Looting MegaGlest/megaglest-source#17
    - HP and EP starting values
    - <target-height> <burn-height> can be given
    https://docs.megaglest.org/XML/Unit#target-height
    - +several bugfixes

ckorn pushed a commit to ckorn/PlayDeb that referenced this pull request Jan 25, 2015

Christoph Korn
megaglest: 3.11.0-1~getdeb1
  * New upstream version
    - healthbars with a lot of options
    - multi shot / multi-projectiles with different timings,sounds and
    particle systems
    - several camera shake effects
    - new tileset "pine rock"
    - some new maps
    - improve switching settings when connected to a headless server
    - support for team unit sharing
    - team resource sharing
    - tags feature
    - Attack boosts fixed in many ways
    - Attack boosts and upgrades now support upgrading attack speed
    - timed particles and mesh bound particles really work now.
    - unit height independend particle positioning
     ( flat-particle-positions )
    - CPU players multiplier are displayed in debug view
    - You can have non commandable units
    - Units spawned by an attack skill can get an attack command
    - Unit and Splash particles can be speeded up ( accelerated )
    - Looting MegaGlest/megaglest-source#17
    - HP and EP starting values
    - <target-height> <burn-height> can be given
    https://docs.megaglest.org/XML/Unit#target-height
    - +several bugfixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment