Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • solarus solarus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 222
    • Issues 222
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 8
    • Merge requests 8
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Solarus Games
  • solarussolarus
  • Issues
  • #428

Closed
Open
Created Jan 27, 2014 by Christopho@christophoOwner

Allow to customize the defense of the hero

Created by: christopho

The defense of the hero when being hurt should be customizable. Currently, this is hardcoded as dividing the damage from the enemy or from hero:start_hurt() by 1, 2 or 4 depending on the tunic.

Proposed new API:

The enemy damage parameter, as well as the damage parameter of hero:start_hurt(), should accept a number or a function.

  • If damage is a number, it corresponds to some life points to remove. By default, the hero loses this number of life points divided by the tunic. If the user wants to override this behavior, for example to take into account the shield, he can define hero:on_hurt(base_life_points). If hero:on_hurt() is defined, no life points are removed: the script is responsible to do it.
  • If damage is a function, this corresponds to custom damage. The magic_damage parameter can be removed: use a custom damage function instead.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking