@@ -7,12 +7,67 @@ public static bool Start(string account, string commandBody, RootController cont
7
7
{
8
8
if ( controller . vm != null ) return false ;
9
9
Map map = new Island68 ( $ "file:{ nameof ( Island68 ) } ?mode=memory&cache=shared") ;
10
- map . JudgeEndGame = ( SukaLambdaEngine ? vm ) => false ;
10
+ Lakhesh lakhesh = new Lakhesh ( account ) ;
11
+ GetWater getWater = new GetWater ( lakhesh ) ;
12
+ lakhesh . skills . Add ( getWater ) ;
13
+ map . JudgeEndGame = ( SukaLambdaEngine ? vm ) =>
14
+ {
15
+ // lose
16
+ if ( vm == null || vm . map == null ) return true ;
17
+ Tuple < ushort , ushort > ? position = vm . map . CharacterPosition ( lakhesh , out _ ) ;
18
+ if ( position == null ) return true ;
19
+
20
+ // win
21
+ if ( map . blocks . TryGetValue ( position , out MapBlock ? b )
22
+ && b . GetType ( ) == typeof ( Warehouse ) && getWater . hasWater )
23
+ return true ;
24
+
25
+ return false ;
26
+ } ;
11
27
12
28
SukaLambdaEngine vm = new ( controller , map : map ) ;
13
- vm . AddCharacter ( new Lakhesh ( account ) , 0 , 0 , new Heading ( HeadingDirection . E ) ) ;
29
+ vm . AddCharacter ( lakhesh , 0 , 0 , new Heading ( HeadingDirection . E ) ) ;
14
30
return true ;
15
31
}
32
+
33
+ public class GetWater : Skill
34
+ {
35
+ public bool hasWater = false ;
36
+ public GetWater ( Character owner ) : base ( owner ) { }
37
+
38
+ public override List < NumericEffect > Execute ( SkillExecution skillExecution , SukaLambdaEngine vm , object [ ] ? metaArgs = null )
39
+ {
40
+ if ( hasWater == false )
41
+ {
42
+ hasWater = true ;
43
+ owner . statusCommitted . Mobility -= ( long ) Math . Abs ( owner . statusCommitted . Mobility * 0.4 ) ;
44
+ }
45
+ return new List < NumericEffect > ( ) ;
46
+ }
47
+
48
+ [ InGameCommand ( "water" , "w|water" , "Get water within distance 1; Mobility -40%" ) ]
49
+ public override bool PlanUseSkill ( string commandBody , SukaLambdaEngine vm )
50
+ {
51
+ if ( hasWater || vm . map ? . GetType ( ) != typeof ( Island68 ) ) return false ;
52
+ Tuple < ushort , ushort > ? position = vm . map . CharacterPosition ( owner , out _ ) ;
53
+ if ( position == null ) return false ;
54
+ MapBlock ? b ;
55
+ foreach ( Tuple < ushort , ushort > coordinate in vm . map . AllCoordinatesWithinManhattanDistance ( position , 1 ) )
56
+ {
57
+ if ( vm . map . blocks . TryGetValue ( coordinate , out b )
58
+ && b . GetType ( ) == typeof ( Water ) )
59
+ {
60
+ vm . PrepareSkill ( new SkillExecution ( owner , this , new Character [ ] { } , null ) ) ;
61
+ return true ;
62
+ }
63
+ }
64
+ return false ;
65
+ }
66
+
67
+ public override string WriteLogAtStart ( SukaLambdaEngine vm ) => "" ;
68
+ public override string WriteLogAtEnd ( SukaLambdaEngine vm ) => "水を得る!" ;
69
+ public override string WriteLogForEffect ( NumericEffect effect , SukaLambdaEngine vm ) => "" ;
70
+ }
16
71
public Island68 ( string databasePath , SukaLambdaEngine ? vm = null ) : base ( databasePath , 1 , 1 , vm )
17
72
{
18
73
string generator = """
0 commit comments