I have an integer that is initially 0 and after the calculation, often ends between 0 - 99. The problem is that in the early stages of the game, it often calculates 0 or 1, rather than a real value, it is assigned as a TrueClass or FalseClass, which in the future compares X> 0. Is there a Ruby router to force variables in the form of a throwing / integer type, or should I have to port it?
This code applies here:
Step 10: Calculate the magic protection multiplier of the target
mdef_multi = self.mdef_multi # steps 11: Modify the Magic Rescue Multiplier # If the user.states.include to Todd mdef_multi = 0 (11) # If you are charged on user.states.include, MDF_multi = 0 (30) # PC or PC on PC Pouring on # 0 if you want to target PC PC then MDEFMT = self.is_a? (Game_Actor) and user.is_a? (Game_Actor)? 0: mdef_multi # 99 MDF Multi-Max MDF mdef_multi = self.is_a? (Game_Enemy) and mdef == 255? 99: mdef_multi # if Solo Multiplier is enabled mdef_multi = obj.element_set.include? (26)? 1: mdef_multi # Step 12: Modify spell multiplier hit = 0, defaults = 0, degradation = 0 while spl_multi & gt; 0 spl_multi - = 1 if rand (99) & lt; = Hit if mdef_multi & gt; 0 is the last line, where I run into a problem of variable-type, it is technically RGSS 2 from RPG Maker VX and please excuse me of the terrible comment and coding style.
First of all, Ruby does not automatically convert things, so your integer does not change in bullion. Because it's 0 or 1.
Instead, what is happening
mdef_multi = self.is_a? (Game_Actor) and user.is_a? (Game_Actor)? Parsing as 0: mdef_multi
(mdef_multi = self.is_a? (Game_Actor)) and user.is_a? (Game_Actor)? 0: mdef_multi The way and works basically more than = in and Is accurate, so the variable is being set to the result only before and , which is a true / false value & Amp; Amp; has more priority over = , so here and & amp; Amp; For this reason, some Ruby programmers should only use & amp; Amp; , do not recommend using and any time. See for more explanation.
If you use and on this line instead of and and the next one, then fix the problem.
Comments
Post a Comment