Hi, i just start working with Lunatic Code. I take a look on this example
but i am not sure what does it do and there are some lines i don't understand.
Can you guys help me to explain those : D thanks
<Custom Apply Effect>
// Sets the counter on the state to 4.
user.setStateCounter(stateId, 4);
// Determine the damage of the roots being cut.
user._thornBindDmg = origin.mat * 2;
What is these 2 value? user._thornBindDmg & origin.mat (if i understand it right,
this is base magicpower of the user without any additional from weapons/buffs?)
// Determine the maximum cap of the damage.
user._thornBindDmg = Math.min(user._thornBindDmg, 1000);
</Custom Apply Effect>
<Custom Deselect Effect>
// Get the result of the target.
var result = target.result();
// Check if the target is hit, alive, the action is physical, and dealing damage.
if (result.i****() && !target.isDead() && this.isPhysical() && this.isDamage()) {
// Play animation on target.
target.startAnimation(12);
// Get the amount of damage dealt.
var dmg = target._thornBindDmg || 1;
This value target._thornBindDmg seem to be user._thornBindDmg above??
// Make the target lose HP.
target.gainHp(-dmg);
Is this necessary? i thought "Deselect Effect" happen after damage execution?
Isn't this going to apply damage on target a second time?
// Disable critical hit effects.
target.result().critical = false;
Again, what is this for since damage execution happened?
// Start the damage popup.
target.startDamagePopup();
// Clear the result.
target.clearResult();
??? is this for bug catch?
// Change the counter on the state to drop by 1.
target.addStateCounter(stateId, -1);
// Check if the counter has reached 0.
if (target.getStateCounter(stateId) <= 0) {
// Remove the state.
target.removeState(stateId);
}
}
</Custom Deselect Effect>
Final question, now i see that there were some assignment like:
var result = target.result();
user._thornBindDmg = origin.mat * 2;
I wonder what is scope of these value? is 'result' value access-able while no battler performing attack? or it is available in this trunk of code only? a temporary variable?
What about user._thornBindDmg? this look more like an object/property to me but i am not sure...
what is scope of this one? global in that battle? or that turn only? that trunk of code only?
but i am not sure what does it do and there are some lines i don't understand.
Can you guys help me to explain those : D thanks
<Custom Apply Effect>
// Sets the counter on the state to 4.
user.setStateCounter(stateId, 4);
// Determine the damage of the roots being cut.
user._thornBindDmg = origin.mat * 2;
What is these 2 value? user._thornBindDmg & origin.mat (if i understand it right,
this is base magicpower of the user without any additional from weapons/buffs?)
// Determine the maximum cap of the damage.
user._thornBindDmg = Math.min(user._thornBindDmg, 1000);
</Custom Apply Effect>
<Custom Deselect Effect>
// Get the result of the target.
var result = target.result();
// Check if the target is hit, alive, the action is physical, and dealing damage.
if (result.i****() && !target.isDead() && this.isPhysical() && this.isDamage()) {
// Play animation on target.
target.startAnimation(12);
// Get the amount of damage dealt.
var dmg = target._thornBindDmg || 1;
This value target._thornBindDmg seem to be user._thornBindDmg above??
// Make the target lose HP.
target.gainHp(-dmg);
Is this necessary? i thought "Deselect Effect" happen after damage execution?
Isn't this going to apply damage on target a second time?
// Disable critical hit effects.
target.result().critical = false;
Again, what is this for since damage execution happened?
// Start the damage popup.
target.startDamagePopup();
// Clear the result.
target.clearResult();
??? is this for bug catch?
// Change the counter on the state to drop by 1.
target.addStateCounter(stateId, -1);
// Check if the counter has reached 0.
if (target.getStateCounter(stateId) <= 0) {
// Remove the state.
target.removeState(stateId);
}
}
</Custom Deselect Effect>
Final question, now i see that there were some assignment like:
var result = target.result();
user._thornBindDmg = origin.mat * 2;
I wonder what is scope of these value? is 'result' value access-able while no battler performing attack? or it is available in this trunk of code only? a temporary variable?
What about user._thornBindDmg? this look more like an object/property to me but i am not sure...
what is scope of this one? global in that battle? or that turn only? that trunk of code only?

