WebCity
  • WebCity
  • What is WebCity
    • FAQ
    • Roadmap
    • Algorithm
    • Features
  • Documentation
    • How to Use
    • Getting Started
      • How to Play?
      • Stage 2
      • Stage 3
      • Local Installation
    • Dashboard
      • Balances
      • Chart
      • Account
    • Plugins
    • Make a WebCity Clone
      • Battle Loop
      • Game Loop
        • Tutorial
  • About Us
    • Where to Go (Links)
Powered by GitBook
On this page
  1. Documentation
  2. Make a WebCity Clone

Battle Loop

PreviousMake a WebCity CloneNextGame Loop

Last updated 1 year ago

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