[A83] Re: help!
[Prev][Next][Index][Thread]
[A83] Re: help!
>From: aled hansson <aled@freebox.com>
>Reply-To: assembly-83@lists.ticalc.org
>To: assembly-83@lists.ticalc.org
>Subject: [A83] help!
>Date: Tue, 20 Mar 2001 11:08 GMT+00:00
>
>
>I have a question. How do I do a equation like this, I will use it in a
>battle engine in an RPG. The problem is that all the numbers are 16-bit. In
>this example I use the players strenght and attack values to define a
>damage:
>
>(PLAYER STRENGHT / 2) + (PLAYER ATTACK) + (int rand(PLAYER ATTACK+1 >
>PLAYER ATTACK / 3)
;Haven't tested this out, might work
CalculateDamage:
ld hl,(strength)
srl h
rr l
ex de,hl
ld hl,(attack)
push hl
add hl,de
ex (sp),hl
inc hl
push hl
dec hl
ld a,3
bcall(_divhlbya) ; or call, if not using 83+ ion
ex de,hl
pop hl
or a
sbc hl,de
;Damage spread won't exceed 255...
ld b,l
call ionrandom
pop hl
ld d,0
ld e,a
add hl,de
ret
;This may work.
>
>thanks
>Alex
>
>
>
>
>_________________________________________________________
>FreeBox - The World's Finest Web Mail Solution
>Get your own FREE email account at http://www.freebox.com
>
>
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
Follow-Ups: