-
Notifications
You must be signed in to change notification settings - Fork 263
/
configs.py
63 lines (55 loc) · 1.54 KB
/
configs.py
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
from pdb import set_trace as T
from forge.blade.core.config import Config
from forge.blade.lib import utils
import numpy as np
class Experiment(Config):
def defaults(self):
super().defaults()
self.MODELDIR='resource/logs/'
self.HIDDEN = 32
self.TEST = False
self.LOAD = False
self.BEST = False
self.SAMPLE = False
self.NATTN = 2
self.NPOP = 1
self.SHAREINIT = False
self.ENTROPY = 0.01
self.VAMPYR = 1
self.AUTO_TARGET = False
#Foraging only
class Law(Experiment):
def defaults(self):
super().defaults()
#Damage
def MELEEDAMAGE(self, ent, targ): return 0
def RANGEDAMAGE(self, ent, targ): return 0
def MAGEDAMAGE(self, ent, targ): return 0
#Foraging + Combat
class Chaos(Experiment):
def defaults(self):
super().defaults()
self.RANGERANGE = 2
self.MAGERANGE = 3
def vamp(self, ent, targ, frac, dmg):
dmg = int(frac * dmg)
targ.food.decrement(amt=dmg)
targ.water.decrement(amt=dmg)
ent.food.increment(amt=dmg)
ent.water.increment(amt=dmg)
#Damage formulas. Lambdas don't pickle well
def MELEEDAMAGE(self, ent, targ):
dmg = 10
targ.applyDamage(dmg)
self.vamp(ent, targ, self.VAMPYR, dmg)
return dmg
def RANGEDAMAGE(self, ent, targ):
dmg = 2
targ.applyDamage(dmg)
self.vamp(ent, targ, self.VAMPYR, dmg)
return dmg
def MAGEDAMAGE(self, ent, targ):
dmg = 1
targ.applyDamage(dmg)
self.vamp(ent, targ, self.VAMPYR, dmg)
return dmg