If the conditions monstarHP and monstar2HP are >0:
If monstar acts first,
Perform the above operation permanently.Also, if either LEFTHP reaches <0, it ends immediately
Is this using if and for? Or I'll look for another way.
If you want to do this repeatedly,
It's 80 instead of LEFTHP100, so
Next, I want to subtract -20 from 80.
I think it's roughly as follows.
since the value is taken out by the method (
I think it's running on an external method.
HP is an attribute value of
monster and must be rewritten.
For example, add a method to set attribute values as follows:
This allows you to take out the monster value, calculate the damage, and write it back.
In C#, there is a syntax as a property when you don't want these attribute values to be private and you don't want them to handle them directly (so you exchange them via methods).
If you use properties to write the same way, you will see the following:
It seems to be dealing with attribute values directly from the outside, so you can simply write as follows:
Personally, rather than doing this outside,
I think it's better to call like this
© 2022 OneMinuteCode. All rights reserved.