A problem with PHP processing the turn-based PK process

Source: Internet
Author: User
The game is you hit me, I hit you a bit, both sides have played into the following round, now is the case. On the left is the offensive side, first hit------------left character A, character B, character C------------right enemy apk process is character a----> attack: Enemy a enemy a----> attack: Character A (now the enemy has finished attacking, left no attack finished) Character B----> attack: Enemy a character C----> attack: The enemy a========== here, a round of attacks, even if completed, into the next round of pk===== character initiator (i.e. left) character a----> attack: Enemy a enemy a----> attack: Character A (now the enemy has finished attacking, left no attack) Character B----> attack: Enemy a character C----> attack: Enemy a ... For example, the characters on both sides are made up of arrays. Character $humen = Array (1 = = Array (' name ' = ' + ' character a ' is_attack ' =>0,//indicates whether this round has been attacked, resets him in the new round), 2 = = Array (' name ' = ' character B ', ' Is_attack ' =>0,), 3 = = Array (' name ' = ' + ' character C ', ' I S_attack ' =>0,));//Enemy $enemy= Array (1 = = Array (' name ' = ' enemy a ', ' Is_attack ' =>0,),) ; In the end, this process is formed.
  Array (launch = ' left ', Attackor = 1,//character A launches attack hurt = = Array (0 = = Array (' Beattackors ' + 1),//Enemy A is attacked Beattackors array index of the corresponding place), 1 = = Array (launch = ' right ', Attackor =& Gt    1,//Enemy A initiates an attack hurt = = Array (0 = + Array (' beattackors ' + 1),//character A is attacked by the beattackors of the corresponding place)), 2 = = Array (launch = ' left ', Attackor = 2,//character B launches attack hurt = = Array (0 = = Array (' Be        Attackors ' + 1),//Enemy A is attacked by the array index of the beattackors corresponding place), and//here as the enemy has been attacked, but the party has not finished attacking, continue to the Left 3 = array (  Launch = ' Left ', Attackor = 3,//character C launches attack hurt = = Array (0 = = Array (' beattackors ' = 1), Attacking an array index of the enemy a beattackors corresponding place));

How does PHP implement this PK process?

Reply content:

The game is you hit me, I hit you a bit, both sides have played into the following round, now is the case. On the left is the offensive side, first hit------------left character A, character B, character C------------right enemy apk process is character a----> attack: Enemy a enemy a----> attack: Character A (now the enemy has finished attacking, left no attack finished) Character B----> attack: Enemy a character C----> attack: The enemy a========== here, a round of attacks, even if completed, into the next round of pk===== character initiator (i.e. left) character a----> attack: Enemy a enemy a----> attack: Character A (now the enemy has finished attacking, left no attack) Character B----> attack: Enemy a character C----> attack: Enemy a ... For example, the characters on both sides are made up of arrays. Character $humen = Array (1 = = Array (' name ' = ' + ' character a ' is_attack ' =>0,//indicates whether this round has been attacked, resets him in the new round), 2 = = Array (' name ' = ' character B ', ' Is_attack ' =>0,), 3 = = Array (' name ' = ' + ' character C ', ' I S_attack ' =>0,));//Enemy $enemy= Array (1 = = Array (' name ' = ' enemy a ', ' Is_attack ' =>0,),) ; In the end, this process is formed.
  Array (launch = ' left ', Attackor = 1,//character A launches attack hurt = = Array (0 = = Array (' Beattackors ' + 1),//Enemy A is attacked Beattackors array index of the corresponding place), 1 = = Array (launch = ' right ', Attackor =& Gt    1,//Enemy A initiates an attack hurt = = Array (0 = + Array (' beattackors ' + 1),//character A is attacked by the beattackors of the corresponding place)), 2 = = Array (launch = ' left ', Attackor = 2,//character B launches attack hurt = = Array (0 = = Array (' Be        Attackors ' + 1),//Enemy A is attacked by the array index of the beattackors corresponding place), and//here as the enemy has been attacked, but the party has not finished attacking, continue to the Left 3 = array (  Launch = ' Left ', Attackor = 3,//character C launches attack hurt = = Array (0 = = Array (' beattackors ' = 1), Attacking an array index of the enemy a beattackors corresponding place));

How does PHP implement this PK process?

A sequence of attacks is arranged by the speed attribute, the attack is completed, the queue is

Increase the Count attribute in the $humen, record who has attacked, and the character in each item increases the blood bar value attribute and the Is_alive attribute, the blood does not have the is_alive false;

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.