Paste #11581: Edit of P#11580 - Untitled Paste

Date: 2014/11/27 09:18:49 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


# +----------------------------------
# |   List of fight flags
# +----------------------------------

# target (The player you are attacking)
# fight (the fight number)
# fight_CD (fight cooldown)
# Player_Fight (fight number for the players)
# Fight_Turn (Whoever has this flag has the turn in the fight)
# Fight_Unhealthy_Start (starting with less than full health)
# NoF_<server.flag[Fight]> (number of fighters and their names in a list)
# Fighter (what number the fighter is)


#<p@player.flag[<flag_name>]>

#ยป Use to change a player's health limit to 50. 
#- health <player> 50 
#- heal (<#.#>) ({player}/<entity>|...)
#- hurt (<#.#>) ({player}/<entity>|...)
#<li@list.size> (returns the size of the list)
#<li@list.include[...|...]>
#.include[three|four]
#<player.location.distance[<player2.location>]> < 5

Fight_Script:
    type: world
    events:
# +----------------------------------
# |   Fight Start
# +----------------------------------
        on fight command:
        - determine passively fulfilled

# Flagging server with Fight_Number (counts how many fights have been started.)
        - flag server Server_Fight_Number:++

# assigning Unique fight name to the players
        - flag player Fight:<player.name>
        - flag p@<context.parsed_args.get[1]> Fight:<player.name>

# Making a list of all the players in the fight
        - define Fighters_<player.name>  li@
        - define Fighters_<player.name> <def[Fighters_<playername>].include[<player.name>|<context.parsed_args.get[1]>]>

# TESTING if list is succesful
        - narrate "<dark_red>Players in fight<&co> <gold><def[Fighters_<player.name>].formatted>"
        - narrate "<dark_red>Numer of players in fight<&co> <gold><def[Fighters_<player.name>].formatted>"

# Assigning the turn counter.
        - flag server Fight_Turn_Counter_<player.name>

# Giving the turn to the attacker [Temporary]
        - flag player Fight_Turn

# +----------------------------------
# |   Attack
# +----------------------------------
        on attack command:
        - determine passively fulfilled

# Removing the players turn
        - flag player Fight_Turn:!

# Adding one to the turn counter
        - flag server Fight_Turn_Counter_<player.flag[Fight]>:++

# Running the task script that determines who's turn it is.
        - run Fight_Turn_Chooser

# +----------------------------------
# |   Fight Turn
# +----------------------------------
        on turn command:
        - determine passively fulfilled


Fight_Turn_Chooser:
    type: task
    Script:
# Checking if the Fight_Turn_Counter number is bigger than the amount of players in the fight
      - if <server.flag[Fight_Turn_Counter]> > <li@Fighers_<player.flag[Fight]>.size> {
# If it's bigger than the amount of players, resetting it to "1"
        - flag server Fight_Turn_Counter_<player.flag[Fight]>:1
# [Temporary] Confirmation that it worked.
        - narrate "<dark_red>Resetting Fight_Turn_Counter<player.flag[Fight]> to 1"
# Flagging the first player with their turn
        - flag p@<li@Fighters_<player.flag[Fight]>.get[1].as_player> Fight Turn
# [Temporary] Confirmation that it worked.
        - narrate "<dark_red>Flagging first player<&co> <li@Fighters_<player.flag[Fight]>.get[1].as_player>"

# If there's more players in the fight than the current turn counter number. Find the next player
        } else {
# Flagging the next player with their Turn
        - flag p@<li@Fighters_<player.flag[Fight]>.get[<server.flag[Fight_Turn_Counter]>].as_player>  Fight_Turn
# [Temporary] Confirmation that it worked.
        - narrate "<dark_red>Flagging next player<&co> <li@Fighters_<player.flag[Fight]>.get[<server.flag[Fight_Turn_Counter]>].as_player>"
        }