GetPlayerAttackDamage() calculate how much dmg you can deal!

Advanced game related topics
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

GetPlayerAttackDamage() calculate how much dmg you can deal!

Post by Rescator »

This was just something I was messing around with,
but maybe it will be usefull for someone.
This is very similar to what FPS, MMORPG, RPG's etc do.

Code: Select all

Procedure.l GetPlayerAttackDamage(level.l,strength.l,weapon.l)
 ;This is our magic. add more *(whatever/level) to include more stats.
 multiplier.f=(weapon/level)*(strength/level)
 If multiplier>1.2 ;max 20% OE (over equipping) allowed, more and give a penalty.
  multiplier=1.0/multiplier
  If multiplier<0.5
   multiplier=0.5 ;max 50% penalty, give them a fighting chance.
  EndIf
 EndIf
 ProcedureReturn (level*multiplier)
EndProcedure


playerlevel.l=10
playerstrength.l=10
playerweapon.l=10

playerdamage.l=GetPlayerAttackDamage(playerlevel,playerstrength,playerweapon)

Debug "A level "+Str(playerlevel)+" player"
Debug "with level "+Str(playerstrength)+" strength"
Debug "and level "+Str(playerweapon)+" weapon"
Debug "can do "+Str(playerdamage)+" damage."
Fool around with the:

playerlevel.l=10
playerstrength.l=10
playerweapon.l=10

values to see how the OE (over equipping) behaves, how much the penalty is.