Date: 2014/11/27 09:18:49 UTC-08:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# +----------------------------------
# | 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>"
}