-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathPoliticalSystem.cs
189 lines (166 loc) · 4.53 KB
/
PoliticalSystem.cs
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*******************************************************************************
*
* Space Trader for Windows 2.01
*
* Copyright (C) 2008 Jay French, All Rights Reserved
*
* Additional coding by David Pierron
* Original coding by Pieter Spronck, Sam Anderson, Samuel Goldstein, Matt Lee
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* If you'd like a copy of the GNU General Public License, go to
* http://www.gnu.org/copyleft/gpl.html.
*
* You can contact the author at [email protected]
*
******************************************************************************/
using System;
namespace Fryz.Apps.SpaceTrader
{
public class PoliticalSystem
{
#region Member Declarations
private PoliticalSystemType _type;
private int _reactionIllegal; // Reaction level of illegal goods 0 = total acceptance (determines how police reacts if they find you carry them)
private Activity _activityPolice; // Activity level of police force 0 = no police (determines occurrence rate)
private Activity _activityPirates; // Activity level of pirates 0 = no pirates
private Activity _activityTraders; // Activity level of traders 0 = no traders
private TechLevel _minTech; // Mininum tech level needed
private TechLevel _maxTech; // Maximum tech level where this is found
private int _bribeLevel; // Indicates how easily someone can be bribed 0 = unbribeable/high bribe costs
private bool _drugsOk; // Drugs can be traded (if not, people aren't interested or the governemnt is too strict)
private bool _firearmsOk; // Firearms can be traded (if not, people aren't interested or the governemnt is too strict)
private TradeItemType _wanted; // Tradeitem requested in particular in this type of government
#endregion
#region Methods
public PoliticalSystem(PoliticalSystemType type, int reactionIllegal, Activity activityPolice, Activity activityPirates,
Activity activityTraders, TechLevel minTechLevel, TechLevel maxTechLevel, int bribeLevel, bool drugsOk,
bool firearmsOk, TradeItemType wanted)
{
_type = type;
_reactionIllegal = reactionIllegal;
_activityPolice = activityPolice;
_activityPirates = activityPirates;
_activityTraders = activityTraders;
_minTech = minTechLevel;
_maxTech = maxTechLevel;
_bribeLevel = bribeLevel;
_drugsOk = drugsOk;
_firearmsOk = firearmsOk;
_wanted = wanted;
}
public bool ShipTypeLikely(ShipType shipType, OpponentType oppType)
{
bool likely = false;
int diffMod = Math.Max(0, (int)Game.CurrentGame.Difficulty - (int)Difficulty.Normal);
switch (oppType)
{
case OpponentType.Pirate:
likely = (int)ActivityPirates + diffMod >= (int)Consts.ShipSpecs[(int)shipType].Pirates;
break;
case OpponentType.Police:
likely = (int)ActivityPolice + diffMod >= (int)Consts.ShipSpecs[(int)shipType].Police;
break;
case OpponentType.Trader:
likely = (int)ActivityTraders + diffMod >= (int)Consts.ShipSpecs[(int)shipType].Traders;
break;
}
return likely;
}
#endregion
#region Properties
public Activity ActivityPirates
{
get
{
return _activityPirates;
}
}
public Activity ActivityPolice
{
get
{
return _activityPolice;
}
}
public Activity ActivityTraders
{
get
{
return _activityTraders;
}
}
public int BribeLevel
{
get
{
return _bribeLevel;
}
}
public bool DrugsOk
{
get
{
return _drugsOk;
}
}
public bool FirearmsOk
{
get
{
return _firearmsOk;
}
}
public TechLevel MaximumTechLevel
{
get
{
return _maxTech;
}
}
public TechLevel MinimumTechLevel
{
get
{
return _minTech;
}
}
public string Name
{
get
{
return Strings.PoliticalSystemNames[(int)_type];
}
}
public int ReactionIllegal
{
get
{
return _reactionIllegal;
}
}
public PoliticalSystemType Type
{
get
{
return _type;
}
}
public TradeItemType Wanted
{
get
{
return _wanted;
}
}
#endregion
}
}