View Single Post
  #73  
Old 10-16-2015, 04:15 PM
AdrianD
Discordant
 
Join Date: Dec 2013
Posts: 297
Default

I added a mechanic to <channelchance> and am wondering if it looks right or if it could be done better. It may be a little confusing but the purpose was learning as much as adding this code. It's an exercise in futility trying to channel at lower levels and the added mechanic mitigates this a bit. It also reinforces those who practice skills when they level, like the old days.

Also, the <distance_moved> and <distancemod> formulas do not do as advertised. The idea seems proper but the implementation is off. I will add to this my results when I get to it.

The big thing I am wondering is if the code in the header is returning the value for the previous level max skill. This mechanic seems to work upon initial testing.

\zone\client.h(695)
Code:
	inline uint16 PrevMaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()-1); }
\zone\spells.cpp(1105) - <void Mob::CastedSpellFinished>
Code:
				// max 93% chance at 252 skill
				channelchance = 30 + GetSkill(SkillChanneling) / 400.0f * 100;
				
				uint16 cS = CastToClient()->GetRawSkill(SkillChanneling); // current skill
				uint16 mS = CastToClient()->MaxSkill(SkillChanneling); // current level max skill
				uint16 pS = CastToClient()->PrevMaxSkill(SkillChanneling); // current level - 1 max skill
				double iA = 20 / (mS - pS); // adjustment interval
				double cA = 0; // cA = adjustement coefficient
				double param, result;
				param = (pow((.0005*cS), 2));

				while (true)
				{
					if (cS >= 200) { 
						break;
					}					
					else if (cS <= pS) {
						break;
					}
					else if (GetLevel () <= 1) {
						cA = (cS * 2);
						result = cA - param;
						channelchance += result;
						break;
					}
					else {
						cA = ((cS - pS)*iA);
						result = cA - param;
						channelchance += result;						
					}
					break;
				}
				channelchance -= attacked_count * 2;
				channelchance += channelchance * channelbonuses / 100.0f;
			}

<snip code>
					distance_moved = d_x * d_x + d_y * d_y;
					// if you moved 1 unit, that's 25% off your chance to regain.
					// if you moved 2, you lose 100% off your chance
					distancemod = distance_moved * 25;
					channelchance -= distancemod;
				}
Thanks

EDIT: here is a visualization of the behavior http://prnt.sc/8s311y

The blue line is the current, unadjusted channelchance. The lower red function is the formula I added. The upper red function is max skill channelchance after adding the the formula.
Reply With Quote