Need a Php function

Discussion in 'PHP' started by iama_gamer, Dec 21, 2008.

  1. #1
    Scenario:
    1 team attacks the other both have thugs,bodyguards(bgs) and hitmen.

    Attacking: hitmen>thugs>bgs
    Defending: hitmen>bgs>thugs

    So what i need is a function in Php which takes the number in each of the 6 units as inputs and returns values of the number of guys dead in each of the 6 units. Need to be able to set the ratio of strengths too like how much stonger or weaker each unit is with respect to attacking thugs.

    eg: if i pass a_hitman=100 , a_thugs=100, a_bgs=100, d_hitman=100 , d_thugs=100, d_bgs=100

    i get a_hkilled=10 , a_tkilled=20 , a_bkilled=30 , d_hkilled=10 , d_tkilled=30, d_bkilled=20

    you can set the ratios as variables which i can change. Please let me know how this can be achieved
     
    iama_gamer, Dec 21, 2008 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    Something like this can make use of object orientated.
     
    Kaizoku, Dec 21, 2008 IP