View Single Post
  #6  
Old 01-06-2008, 09:22 AM
zeiksz2
Fire Beetle
 
Join Date: Oct 2007
Posts: 20
Default type stuff

another problem i found in my npc::attack code is that max_dmg is not normal int type, so if it would get negative it gets 65535-. so used a temp int

Code:
			min_dmg=1;
			if (weapon_damage==1) {
				//possible hand to hand was done,
				//we don't want that unarmed, brawling, clawing, biting stuff behaving like a w00sh, so we correct weapon damage to level
				weapon_damage=(mylevel/5);
			}
			int sizematters = ((int)mylevel-(int)otherlevel)+((int)this->GetSize()-(int)other->GetSize());	//yes, let it be negative too, if we are tiny we have less "luck"
			if (sizematters>0) {min_dmg+=sizematters;}							//if we are tough our minimum is higher, but if we are "weaker" our minimum can't go bellow 1
			int temp_max_dmg =
				(weapon_damage * ((GetSTR()*20) + (GetSkill(OFFENSE)*15) + (mylevel*10)) / 1000)
				+ sizematters
				;
			if (temp_max_dmg>=1) { max_dmg = temp_max_dmg; } else { max_dmg = 1; }
			if (max_dmg<=min_dmg+eleBane) { damage=min_dmg+eleBane; }
			else { damage=MakeRandomInt(min_dmg+eleBane,max_dmg+eleBane); }
edit: next to be done: no slamming (bash without shield) for several mobs - i mean a giant slamming you into ground is ok, but a qeynos guard is more then a duhhh..

Last edited by zeiksz2; 01-06-2008 at 05:26 PM..
Reply With Quote