Line data Source code
1 : package activity
2 :
3 : import "errors"
4 :
5 : // UserError はユーザ起因の検証失敗。Validate が返す error のうち *UserError だけが
6 : // ユーザ起因で、呼び出し側は Msg を gamelog へ出して操作を取り消す。それ以外の error は致命的
7 : type UserError struct{ Msg string }
8 :
9 : // Error は error インターフェースを満たす
10 1 : func (e *UserError) Error() string { return e.Msg }
11 :
12 : // アクティビティ関連のエラー定数
13 : var (
14 : // アクティビティ一般エラー
15 : ErrActivityNil = errors.New("activity is nil")
16 : ErrBehaviorUnregistered = errors.New("unregistered behavior")
17 : ErrActorNotSet = errors.New("actor is not set")
18 : ErrActivityNotFound = errors.New("activity not found")
19 : ErrActivityActorNotFound = errors.New("activity actor not found")
20 : ErrActivityCannotPause = errors.New("activity cannot be paused")
21 : ErrActivityCannotResume = errors.New("activity cannot be resumed")
22 : ErrUnsupportedActivity = errors.New("unsupported activity type")
23 :
24 : // ErrParamsTypeMismatch は Params の型がアクティビティと合わないことを示す。構築ミスのシステムエラー
25 : ErrParamsTypeMismatch = errors.New("activity params type mismatch")
26 :
27 : // 攻撃関連エラー
28 : ErrAttackTargetInvalid = errors.New("attack target is invalid")
29 : ErrAttackerDead = errors.New("attacker is dead")
30 : ErrTargetNoHPComponent = errors.New("target has no HP component")
31 : ErrInvalidWeaponSlot = errors.New("invalid weapon slot number")
32 : ErrNoAttackSource = errors.New("no valid attack source")
33 :
34 : // 射撃関連エラー
35 : ErrShootNoFireWeapon = errors.New("no ranged weapon equipped")
36 :
37 : // 移動関連エラー
38 : ErrMoveTargetInvalid = errors.New("move destination is invalid")
39 : ErrGridElementNotFound = errors.New("GridElement component not found")
40 :
41 : // アイテム関連エラー
42 : ErrNoItemsToPickup = errors.New("no items to pick up")
43 : ErrItemPickupFailed = errors.New("failed to pick up item")
44 :
45 : // 会話関連エラー
46 : ErrTalkNoDialog = errors.New("talk target has no dialog")
47 : ErrTalkTargetNoName = errors.New("talk target has no name")
48 :
49 : // 休息関連エラー
50 : ErrRestInvalidDuration = errors.New("rest duration is invalid")
51 :
52 : // 待機関連エラー
53 : ErrWaitInvalidDuration = errors.New("wait duration is invalid")
54 :
55 : // 読書関連エラー
56 : ErrReadNeedsBook = errors.New("reading requires a book")
57 : ErrReadTargetInvalid = errors.New("read target is invalid")
58 : ErrReadTargetNotItem = errors.New("read target is not an item")
59 : ErrReadBookNotInBackpack = errors.New("book is not in the backpack")
60 :
61 : // クラフト関連エラー
62 : ErrCraftNeedsRecipe = errors.New("crafting requires a recipe")
63 : ErrCraftTargetInvalid = errors.New("craft target is invalid")
64 : ErrCraftTargetNotRecipe = errors.New("craft target is not a recipe")
65 : ErrCraftRecipeNameGet = errors.New("cannot get recipe name")
66 : ErrCraftMaterialShortage = errors.New("required materials or tools are insufficient")
67 : ErrCraftEntityNotSet = errors.New("crafting entity is not set")
68 :
69 : // ワープ関連エラー
70 : ErrWarpHoleNotFound = errors.New("warp hole not found")
71 : ErrWarpUnknownType = errors.New("unknown warp type")
72 : ErrWarpNoHole = errors.New("no warp hole")
73 : )
|