tests: don't use the readlink option -f when not available (macOS)
[nit.git] / contrib / crazy_moles / src / more_traps.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Add more traps
16 module more_traps
17
18 import moles
19 import effects
20
21 # Nuclear trap
22 class Nuke
23 super Trap
24
25 redef fun penalty_img do return app.assets.penalty_hundred
26
27 redef fun flashes do return [
28 new Flash(5.0, 0.0, 1.0, 0.0, 0.0, 1.25, 2.0),
29 new Flash(0.2, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0)]
30 end
31
32 # Large cactus trap
33 class BigTrap
34 super Trap
35
36 redef fun penalty_img do return app.assets.penalty_twenty
37 end
38
39 redef class Game
40
41 # Nuclear trap
42 var nuke = new Nuke(app.assets.nuke, 180.0*display_scale, 780.0*display_scale, 100) is lazy
43
44 # Large cactus trap
45 var big_cactus = new BigTrap(app.assets.big_cactus, 242.0*display_scale, 820.0*display_scale, 20) is lazy
46 end
47
48 redef class Hole
49 redef fun to_pop
50 do
51 if game.points > 25 then
52 if 25.rand == 0 then return game.big_cactus
53 if game.points > 50 and 100.rand == 0 then return game.nuke
54 end
55
56 return super
57 end
58 end