Convert monster into a class

FossilOrigin-Name: e8f80b0482846dfbd5bf97ed375b13687d325e9ef7e2a79176dac49722180124
This commit is contained in:
Jonathan Schleifer 2025-03-23 02:03:32 +00:00
parent a7db00c740
commit 2c5f2d0342
16 changed files with 319 additions and 224 deletions

39
src/Monster.h Normal file
View file

@ -0,0 +1,39 @@
#import "DynamicEntity.h"
@interface Monster: DynamicEntity
@property (class, readonly, nonatomic) OFMutableArray<Monster *> *monsters;
// one of M_*
@property (nonatomic) int monsterState;
// see Monster.m
@property (nonatomic) int monsterType;
// monster wants to kill this entity
@property (nonatomic) DynamicEntity *enemy;
// monster wants to look in this direction
@property (nonatomic) float targetYaw;
// millis at which transition to another monsterstate takes place
@property (nonatomic) int trigger;
// delayed attacks
@property (nonatomic) OFVector3D attackTarget;
// how many times already hit by fellow monster
@property (nonatomic) int anger;
// called after map start of when toggling edit mode to reset/spawn all
// monsters to initial state
+ (void)restoreAll;
+ (void)resetAll;
+ (void)thinkAll;
+ (void)renderAll;
// TODO: Move this somewhere else
+ (void)endSinglePlayerWithAllKilled:(bool)allKilled;
+ (instancetype)monsterWithType:(int)type
yaw:(int)yaw
state:(int)state
trigger:(int)trigger
move:(int)move;
- (instancetype)initWithType:(int)type
yaw:(int)yaw
state:(int)state
trigger:(int)trigger
move:(int)move;
- (void)incurDamage:(int)damage fromEntity:(__kindof DynamicEntity *)d;
@end