Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    • Menu
    Projects Groups Snippets
  • Get a free trial
  • Sign up
  • Login
  • Sign in / Register
  • solarus solarus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 229
    • Issues 229
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 10
    • Merge requests 10
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

GitLab 15.0 has launched! Please visit Breaking changes in 15.0 and 15.0 Removals to see which breaking changes may impact your workflow.

  • 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