Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6645581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:18:19+00:00 2026-05-26T00:18:19+00:00

I have a hard task here. I’m thinking of building a simple game, and

  • 0

I have a hard task here. I’m thinking of building a simple game, and in this game I’m going to apply a buff system (read here for more information).

So, let’s say I want to create a buff:

<buff name="Life Steal">
  <afterAttack>
    <heal target="attacker">$damage$ * 0.2</heal>`
  </afterAttack>
</buff>

This, in thesis, would generate the following output:

public class Life_Steal extends Buff {

    @Override
    public void afterAttack(Object attacker, Object defender, int damageDone) {
        heal(attacker, damageDone * 0.2);
    }
}

Is this possible? If so, is there any tool out there that enables me to do something like that?


EDIT

I found out that mixing Javascript and XML would be a good way to go for it.

<buff name="Life Steal>
  <onattach>
    <javascript>
      attacker.hp += damage * 0.2;
    </javascript>
  </onattach>
</buff>

That’s the best solution I could think of. Anyone have a better one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:18:20+00:00Added an answer on May 26, 2026 at 12:18 am

    I don’t condone this project, but it is along the lines of what you are doing. Jelly – Executable XML. The most painless way to load XML is JAXB.

    That said, a real scripting language would be a much better choice.

    1. Javascript is included as a scripting engine language by default ( Rhino )
    2. Lua is a good choice as a dedicated embedded scripting language
    3. Jython is very popular
    4. JRuby is available as well

    In any case read Scripting for the Java Platform and Java Scripting Programmers Guide before you go any further.

    If you just have to use XML for some bizarre reason, a mixture of JAXB with scripting imbedded in the XML might be another way to go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like such a simple task, but I'm having a hard time finding
A recent task I have to figure out, gives me some hard time thinking
I have a hard time figuring this one out, it's about mistakes that can
I have a hard time grasping this. When writing in do notation, how are
i have pretty hard task, i need to call to device in the field
So, here's the situation: I have a parent buildfile that defines a compilation task,
This is kind of hard to explain. Basically it's kind of like a simple
Do we have hard performance data that demonstrates an advantage of single quotes over
I am coming from C# background and I have hard time figuring out how
I have 2 hard-drives, C:\ and D:\ Django imports correctly (which is in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.