Magina is surround by hundreds of monsters. Can he survive in T unit times?
Now matter Magina or monster have three attributes(ATI, DEF, HP), but Magina have another attributes (MaxHP). Magina can own some equipments as a hero , there are six kinds of equipment
("Head", "Weapon", "Armor","Shoes", "Trump","Cuff") in this world. Equipment have three attributes (A, D, MH), each standing the value can increase to ATI, DEF and MaxHP of Magina.
To every some kinds of equipment, Magina can only choose one to use. So when he have some kinds of equipments, he will choose the one have the bigger value. The value of equipments define as
A*3 + D*2 + MH. If the value of equipments is equal to the one Magina have, he will not choose to change his equipment.
Now describe a fighting between A and B.
We know A hurt B first, the value of harm define as P.
P = MAX(1,(int)((A's ATI - B's DEF) / ( abs(Xa-Xb) + abs(Ya-Yb) + 1))). (Xa,Ya) and (Xb,Yb) is the position of A and B. So B's HP will reduce P.
Than B hurt A. A will loss MAX(1,(int)((B's ATI - A's DEF) / ( abs(Xa-Xb) + abs(Ya-Yb) + 1))).
Every one will die if his HP is small or equal to 0.
In the 2d-world. Magina standing in the position (0,0) and never moving, in T unit time, n monsters will move nearly to attack he. To every unit time we divide it to four processes.
First Magina choose K monsters to attack once each continuously .(He will attack all if there are no K monsters survived ) If a monster die by attacking, he will drop a equipment. Than Magina can choose weather to use it. The way Magina choose is according to the P which is the value of his hurting to the monster. The first K higher monsters will be selected at the every unit time's begining, if two monsters have some P, the smaller ID of monsters will be selected.
Second every monster survived will hurt Magina once continuously. If Magina die, game over.
Third every monster survived will move to Magina one unit. If the monster is standing the place of Magina, he will not move. One unit is meaning X or Y to change only one.
Fourth Magina will revert W HP.
W = (int) ( MaxHP*0.05 ). The maximum of HP can not bigger than MaxHP.