ChessLang 액션 완전 레퍼런스
액션 레퍼런스
액션은 게임 상태를 수정하는 명령입니다. 트리거, 효과, 스크립트에서 사용됩니다.
기물 액션
set
기물 상태 또는 게임 변수를 수정합니다:
chesslang
# 기물 상태 설정
set piece.state.rage = 3
set piece.state.moved = true
# 게임 상태 설정
set game.state.bonus = 10
# 산술
set piece.state.count = piece.state.count + 1매개변수:
| 매개변수 | 설명 |
|---|---|
| target | 수정할 상태 변수 |
| value | 새 값 |
예시:
chesslang
trigger gain_experience {
on: capture
do: set piece.state.exp = piece.state.exp + captured.value
}
trigger level_up {
on: move
when: piece.state.exp >= 10
do: {
set piece.state.level = piece.state.level + 1
set piece.state.exp = 0
}
}create
보드에 새 기물을 생성합니다:
chesslang
create Pawn at e4
create Queen at d1 for White
create Zombie at origin for captured.owner매개변수:
| 매개변수 | 필수 | 설명 |
|---|---|---|
| type | 예 | 생성할 기물 타입 |
| position | 예 | 배치할 위치 (at 키워드) |
| owner | 아니오 | 소유자 플레이어 (for 키워드, 생략 시 현재 플레이어) |
위치 표현식:
origin: 이동 출발 위치destination/target: 이동 도착 위치e4,[e4]: 특정 칸
예시:
chesslang
# 좀비 체스: 폰이 잡히면 적 좀비로 부활
trigger pawn_rises {
on: capture
when: captured.type == Pawn
do: create Zombie at origin for captured.owner
}
trigger split {
on: move
when: piece.type == Divider
do: create Pawn at origin for piece.owner
}remove
보드에서 기물을 제거합니다:
chesslang
remove piece # 단일 기물 제거
remove captured # 잡힌 기물 제거
remove pieces in radius(1) from destination # 반경 1 내 모든 기물
remove pieces in radius(2) from target where not Pawn # 폰 제외하고 제거매개변수:
| 매개변수 | 설명 |
|---|---|
| target | 제거할 기물 또는 기물들 |
| radius(N) from pos | N칸 반경 내 기물들 (선택) |
| where not Type | 특정 타입 제외 (선택) |
문법:
text
remove <target>
remove pieces in radius(<N>) from <position> [where not <Type>]radius(N): 체비셰프 거리 기준 N칸 반경where not <Type>: 특정 기물 타입 제외
예시:
chesslang
# Atomic Chess: 잡기 시 폭발, 폰 제외
trigger atomic_explosion {
on: capture
do: {
remove pieces in radius(1) from destination where not Pawn
}
}
# 단순 폭발: 모든 인접 기물 제거
trigger simple_explosion {
on: capture
when: piece.type == Bomb
do: {
remove pieces in radius(1) from destination
}
}transform
기물을 다른 타입으로 변경합니다:
chesslang
transform piece to Queen
transform piece to piece.state.evolution매개변수:
| 매개변수 | 설명 |
|---|---|
| piece | 변환할 기물 |
| type | 새 기물 타입 |
예시:
chesslang
trigger promotion {
on: move
when: piece.type == Pawn and target on rank 8
do: transform piece to Queen
}
trigger evolve {
on: capture
when: piece.state.captures >= 3
do: transform piece to piece.state.evolution_type
}
trigger rage_mode {
on: move
when: piece.type == Berserker and piece.state.rage >= 5
do: transform piece to RagingBerserker
}보드 액션
mark
칸에 효과를 적용합니다:
chesslang
mark target with trap
mark origin with shield
mark [e4] with lava매개변수:
| 매개변수 | 설명 |
|---|---|
| position | 표시할 칸 (origin, destination, [e4] 등) |
| effect | 적용할 효과 (with 키워드) |
위치 표현식:
origin: 이동 출발 위치destination/target: 이동 도착 위치piece.pos: 기물 현재 위치[e4],{file: 4, rank: 3}: 특정 위치
예시:
chesslang
effect trap {
blocks: enemy
visual: "red"
}
trigger create_trap {
on: move
when: piece.type == Trapper and piece.state.traps < 3
do: {
mark origin with trap
set piece.state.traps = piece.state.traps + 1
}
}게임 액션
win
승자를 선언합니다:
chesslang
win White
win Black
win player
win opponent
win piece.owner예시:
chesslang
trigger hill_victory {
on: move
when: piece.type == King and target in zone.hill
do: win piece.owner
}
trigger elimination {
on: capture
when: opponent.pieces == 0
do: win player
}lose
패자를 선언합니다:
chesslang
lose White
lose Black
lose player
lose opponent예시:
chesslang
trigger timeout {
on: turn_end
when: game.state.timer <= 0
do: lose player
}draw
무승부를 선언합니다:
chesslang
draw
draw with reason "Mutual agreement"예시:
chesslang
trigger mutual_destruction {
on: capture
when: player.pieces == 1 and opponent.pieces == 1
do: draw
}cancel
현재 액션/이벤트를 취소합니다:
chesslang
cancel예시:
chesslang
trigger guardian_protection {
on: capture
when: any Guardian adjacent to captured where Guardian.owner == captured.owner
do: cancel # 잡기 취소 - 기물이 보호됨
}복합 액션
여러 액션
순차적으로 여러 액션을 실행합니다:
chesslang
trigger complex_capture {
on: capture
when: piece.type == Vampire
do: {
set piece.state.hp = piece.state.hp + captured.value
create Ghost at origin for opponent
mark target with blood
}
}for 루프
반복적으로 액션을 실행합니다:
chesslang
for variable in iterable: {
actions
}예시:
chesslang
trigger clear_all_traps {
on: turn_start
when: piece.type == Cleaner
do: {
for p in pieces where type == Trap {
remove p
}
}
}if 조건문
조건에 따라 다른 액션을 실행합니다:
chesslang
if condition: {
then_actions
} else: {
else_actions
}예시:
chesslang
trigger conditional_reward {
on: capture
do: {
if captured.value >= 5: {
transform piece to piece.state.evolved_form
} else: {
set piece.state.exp = piece.state.exp + captured.value
}
}
}완전한 예시
Trapper Chess (덫 설치자 체스)
선택적 트리거를 사용한 덫 설치 게임입니다:
chesslang
# 덫 효과: 적 이동 차단
effect trap {
blocks: enemy
visual: "red"
}
piece Trapper {
move: step(any)
capture: =move
state: { traps: 0 }
}
# 선택적 트리거: 사용자가 덫 설치 여부 선택
trigger place_trap {
on: move
when: piece.type == Trapper and piece.state.traps < 3
optional: true
description: "덫을 설치하시겠습니까?"
do: {
mark origin with trap
set piece.state.traps = piece.state.traps + 1
}
}Zombie Chess (좀비 체스)
폰이 잡히면 좀비로 부활합니다:
chesslang
piece Zombie {
move: step(any)
capture: =move
traits: [undead]
state: { resurrected: true }
}
# 폰이 잡히면 잡는 기물의 원래 위치에 적 좀비로 부활
trigger pawn_rises {
on: capture
when: captured.type == Pawn
do: create Zombie at origin for captured.owner
}점진적 파워업
chesslang
piece Warrior {
move: step(any)
capture: =move
state: { power: 0, kills: 0 }
}
trigger warrior_power_up {
on: capture
when: piece.type == Warrior
do: {
set piece.state.kills = piece.state.kills + 1
}
}