Battle Loop

graph LR
    subgraph Battle
        subgraph AttackerStart
            oppoLink("Enter Opponent Link") --- player_requestMatch("Start Battle
            (Request match)")
            player_requestMatch --> player_set_unix_and_mode{Wait}
            player_set_unix_and_mode --> Unanswered
            Unanswered -->|9 minutes later| ExitBattle  
            AttackerDecide("Attacker
            Decide
            (or
            (Defender
            Decide))") --> no_action        
            AttackerDecide --> attacked_first_buy("send attack")
            attacked_first_buy --> attacker_buy{buy}
            attacker_buy -->|first buy| attacker_win
            attacker_buy -->|oppo bought first| attacker_loss
            no_action --> attacker_buy2("oppo
            action")
            attacker_buy2 -->|oppo bought| attacker_loss_def
            attacker_buy2 -->|oppo didnt buy| attacker_tie
        end


        attacker_tie --> attacker_tie_candle("Candle")
        attacker_tie_candle -->|Red: price diff <= 0 | atk1("player:+[0,1,0]
        oppo:+[0,1,0]")
        attacker_tie_candle -->|Green: diff > 0| atk2("player:+[0,0,1]
        oppo:+[0,0,1]")


        attacker_loss_def --> attacker_loss_defcandle("Candle")
        attacker_loss_defcandle -->|Red: price diff <= 0 | atkll1("player:+[1,0,0]
        oppo:+[0,0,1]")
        attacker_loss_defcandle -->|Green: diff > 0| atkll2("player:+[0,0,1]
        oppo:+[1,0,0]")
       
        attacker_loss --> attacker_loss_candle("Candle")
        attacker_loss_candle -->|Red: price diff <= 0 | atkl1("player:+[1,0,0]
        oppo:+[0,0,1]")
        attacker_loss_candle -->|Green: diff > 0| atkl2("player:+[0,0,1]
        oppo:+[1,0,0]")


        attacker_win --> attacker_win_candle("Candle")
        attacker_win_candle -->|Red: price diff <= 0 | atkw1("player:+[0,0,1]
        oppo:+[1,0,0]")
        attacker_win_candle -->|Green: diff > 0| atkw2("player:+[1,0,0]
        oppo:+[0,0,1]")












        style attacker_win fill:#bbffbb
        style attacker_loss fill:#ffbbbb
        style attacker_tie fill:#bbbbbb
        style attacker_loss_def fill:#ffbbbb
        subgraph DefenderUser
            oppoAccept  --> DefenderDecide
            oppoAccept  --> AttackerDecide
            DefenderDecide --> ...
                     
        end


        player_set_unix_and_mode --> oppoAccept("Start Battle
        (Accept Match)")
        style AttackerStart fill:#aaddff
    end
   
    style DefenderUser fill:#ffccff
m

Last updated