Description:
Adding events.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -4,8 +4,11 | |||||
|
4 |
|
4 | ||
|
5 | VAR GovernorOpinion = 0 |
|
5 | VAR GovernorOpinion = 0 |
|
6 |
|
6 | ||
|
|
7 | LIST assistantTraits = shy, esoteric, sweary | ||
|
7 |
|
8 | ||
|
8 | //This is needed to make both including and for jumpting to dialog sections work: |
|
9 | |
|
|
10 | |||
|
|
11 | //This is needed to make both including and for jumping to dialog sections work: | ||
|
9 | === placeholder === |
|
12 | === placeholder === |
|
10 |
|
13 | ||
|
11 | -> END |
|
14 | -> END |
@@ -76,7 +79,6 | |||||
|
76 | === BadNewsReact === |
|
79 | === BadNewsReact === |
|
77 |
|
80 | ||
|
78 |
|
81 | ||
|
79 |
|
|||
|
80 | + [Damn.] {inc(playerSwears)} |
|
82 | + [Damn.] {inc(playerSwears)} |
|
81 | ->-> |
|
83 | ->-> |
|
82 | + [Fuck.] {inc(playerSwears)} |
|
84 | + [Fuck.] {inc(playerSwears)} |
@@ -85,6 +87,8 | |||||
|
85 | ->-> |
|
87 | ->-> |
|
86 | + [*Sigh.* Fine.] |
|
88 | + [*Sigh.* Fine.] |
|
87 | ->-> |
|
89 | ->-> |
|
|
90 | + [Who cares?] | ||
|
|
91 | ->-> | ||
|
88 |
|
92 | ||
|
89 | === AssistantAcknowlege === |
|
93 | === AssistantAcknowlege === |
|
90 | + [Thanks.] |
|
94 | + [Thanks.] |
@@ -97,7 +101,7 | |||||
|
97 | -> Appreciate |
|
101 | -> Appreciate |
|
98 |
|
102 | ||
|
99 | = Appreciate |
|
103 | = Appreciate |
|
100 | \#assistantName\#: Oh, you're welcome. |
|
104 | \#assistantName\#: {assistantTraits ? shy:...|{~No problem.|Oh, you're welcome.|My pleasure.}} |
|
101 | ->-> |
|
105 | ->-> |
|
102 |
|
106 | ||
|
103 | === MassVandalism === |
|
107 | === MassVandalism === |
@@ -110,7 +114,7 | |||||
|
110 |
|
114 | ||
|
111 | -> BadNewsReact -> |
|
115 | -> BadNewsReact -> |
|
112 |
|
116 | ||
|
113 | \#assistantName\#: Yeah, it's awful. |
|
117 | \#assistantName\#: Yeah, it's {assistantTraits ? sweary:fucking|} awful. |
|
114 |
|
118 | ||
|
115 | I'll see who's around and get to cleaning. |
|
119 | I'll see who's around and get to cleaning. |
|
116 |
|
120 |
@@ -3,6 +3,8 | |||||
|
3 |
|
3 | ||
|
4 | INCLUDE dialog.ink |
|
4 | INCLUDE dialog.ink |
|
5 |
|
5 | ||
|
|
6 | ~ assistantTraits = (shy, sweary) | ||
|
|
7 | |||
|
6 |
|
8 | ||
|
7 | -> MassVandalism |
|
9 | -> MassVandalism |
|
8 |
|
10 |
@@ -52,11 +52,11 | |||||
|
52 |
|
52 | ||
|
53 | var campaignEntity = CreateEntity(); |
|
53 | var campaignEntity = CreateEntity(); |
|
54 |
|
54 | ||
|
55 | AddComponent(campaignEntity, new TreeDeltaComponent{deltaTrees = new Fact<int>(4)}); |
|
55 | AddComponent(campaignEntity, new TreeDeltaComponent{deltaTrees = new Fact<int>(40)}); |
|
56 |
|
56 | ||
|
57 | // AddComponent(campaignEntity, new AreaComponent{squares=final_squares}); |
|
57 | // AddComponent(campaignEntity, new AreaComponent{squares=final_squares}); |
|
58 | } |
|
58 | } |
|
59 | if (this.Random.Next(0, 10) == 3) |
|
59 | if (this.Random.Next(0, 100) == 3) |
|
60 | { |
|
60 | { |
|
61 | Logging.Debug("Mass vandalism πΏ"); |
|
61 | Logging.Debug("Mass vandalism πΏ"); |
|
62 |
|
62 |
@@ -128,40 +128,44 | |||||
|
128 | { |
|
128 | { |
|
129 | var delta = GetComponent<TreeDeltaComponent>(entity); |
|
129 | var delta = GetComponent<TreeDeltaComponent>(entity); |
|
130 |
|
130 | ||
|
131 | if (delta.deltaTrees.Value < 0) |
|
131 | var squares = HasComponent<AreaComponent>(entity) ? GetComponent<AreaComponent>(entity).squares : this.all_squares; |
|
132 | { |
|
132 | var removed = 0; |
|
133 | var squares = HasComponent<AreaComponent>(entity) ? GetComponent<AreaComponent>(entity).squares : this.all_squares; |
|
133 | var added = 0; |
|
134 | var removed = 0; |
|
134 | var tree_squares = squares.Where((square) => simulation.map.cells[(int)square.X][(int)square.Y].hasTree); |
|
135 | var tree_squares = squares.Where((square) => simulation.map.cells[(int)square.X][(int)square.Y].hasTree); |
|
135 | var to_remove = Math.Abs(delta.deltaTrees.Value); |
|
136 | var to_remove = -delta.deltaTrees.Value; |
|
||
|
137 |
|
136 | ||
|
138 |
|
|
137 | //calculate the probability in order to get the expected number of removed trees |
|
139 |
|
|
138 | var expected = to_remove; |
|
140 |
|
|
139 | var trials = tree_squares.Count(); |
|
141 |
|
|
140 | double probability = ((double)expected / (double)trials) / 12; |
|
142 |
|
141 | ||
|
143 |
|
|
142 | foreach (var square in tree_squares) |
|
|
143 | { | ||
|
|
144 | var cell = simulation.map.cells[(int)square.X][(int)square.Y]; | ||
|
|
145 | if (cell.hasTree | ||
|
|
146 | && random_generator.NextDouble() < probability) | ||
|
144 | { |
|
147 | { |
|
145 | var cell = simulation.map.cells[(int)square.X][(int)square.Y]; |
|
148 | if (delta.deltaTrees.Value < 0) |
|
146 | if (cell.hasTree |
|
||
|
147 | && random_generator.NextDouble() < probability) |
|
||
|
148 | { |
|
149 | { |
|
149 | cell.removeTree(); |
|
150 | cell.removeTree(); |
|
150 | removed++; |
|
151 | removed++; |
|
151 | } |
|
152 | } |
|
152 | if (removed >= to_remove) |
|
153 | else if (delta.deltaTrees.Value > 0) |
|
153 | { |
|
154 | { |
|
154 | // break; |
|
155 | cell.addTree(this.simulation.DateTime); |
|
|
156 | added++; | ||
|
155 | } |
|
157 | } |
|
156 | } |
|
158 | } |
|
157 | Logging.Info(String.Format("Destroyed {0} trees, expected {1}, P(destroy)= {2}", removed, (expected / 12), probability)); |
|
159 | if (removed >= to_remove) |
|
|
160 | { | ||
|
|
161 | // break; | ||
|
|
162 | } | ||
|
158 | } |
|
163 | } |
|
159 | else |
|
164 | Logging.Info(String.Format("Destroyed {0} trees, expected {1}, P(plant)= {2}", removed, (expected / 12.0), probability)); |
|
160 | { |
|
165 | Logging.Info(String.Format("Planted {0} trees, expected {1}, P(destroy)= {2}", added, (expected / 12.0), probability)); |
|
161 | } |
|
||
|
162 | } |
|
166 | } |
|
|
167 | } | ||
|
163 |
|
168 | ||
|
164 | } |
|
||
|
165 | } |
|
169 | } |
|
166 | this.ticksToSend = 0; |
|
170 | this.ticksToSend = 0; |
|
167 |
|
171 |
You need to be logged in to leave comments.
Login now