tdBattlePetScript api

Tony edited this page on 14 Oct 2020 · 41 revisions

Actions

ability / use

Uses a pet ability.
The ability must be available (ie on the ability bar and not on cooldown).

SelectorsNameIDPosition
Examplesability(Moonfire)use(595)ability(#3)

change

Switches out the current pet.
The pet to switch to must be alive and not the current pet.

SelectorsNameIDPositionnext
Exampleschange(Chrominius)change(1152)change(#2)change(next)

catch

Attempts to catch the enemy pet.

Selectors:
Examplescatch

quit

Forfeits the current battle.

Selectors:
Examplesquit

standby

Passes your current turn.

Selectors:
Examplesstandby

test

Prints a message to the chat window.
This is useful why trying to debug a broken script.

Selectors:
Examplestest(Hello world!)

Targets

self / ally

One of your current pets.

SelectorsNameIDPosition (defaults to current pet if not given)
Examplesselfally(Chrominius)self(1152)ally(#2)

enemy

One of the enemy pets.

SelectorsNameIDPosition (defaults to current pet if not given)
Examplesenemyenemy(Chrominius)enemy(1152)enemy(#2)

Abilities

ability.usable

If an ability is usable (ie not on cooldown).

Returnbool
Examplesself.ability(Moonfire).usable

ability.duration

The remaining cooldown for an ability.

Returnvalue
Examplesself.ability(Moonfire).duration

ability.strong

If the ability is strong against the current enemy pet.

Returnbool
Examplesself.ability(Moonfire).strong

ability.weak

If the ability is weak against the current enemy pet.

Returnbool
Examplesself.ability(Moonfire).weak

ability.type

The type of an ability.

Returnvalue
Examplesself.ability(Moonfire).type

Auras

aura.exists

If an aura is currently active.

Returnbool
Examplesself.aura(Dodge).exists

aura.duration

The remaining rounds of an active aura.

Returnvalue
Examplesself.aura(Dodge).duration

Pets

hp

A pets current HP.

Returnvalue
Examplesself.hp

hpp

A pets current HP (for use in comparisons).

Returnvalue
Examplesself.hpp

hp.full

If a pet has full hp.

Returnbool
Examplesself.hp.full

hp.can_explode

If the damage from a pet self-destructing would kill the opponent.

Returnbool
Examplesself.hp.can_explode

hp.high

If the pets hp is higher than the opponents.

Returnbool
Examplesself.hp.high

hp.low

If the pets hp is lower than the opponents.

Returnbool
Examplesself.hp.high

id

The pets id.

Returnvalue
Examplesself.id

level

The pets level.

Returnvalue
Examplesself.level

level.max

If the pet is at max level (25).

Returnvalue
Examplesself.level.max

power

The pets power.

Returnvalue
Examplesself.power

quality

The pets quality.

Returnvalue
Examplesself.quality

type

The pets family.

Returnvalue
Examplesself.type

speed

The pets speed.

Returnvalue
Examplesself.speed

speed.fast

If the pets speed is higher than the opponents.

Returnbool
Examplesself.speed.fast

speed.slow

If the pets speed is lower than the opponents.

Returnbool
Examplesself.speed.slow

Status

active

If the pet is currently active.

Returnbool
Examplesself.active

dead

If the pet is currently dead.

Returnbool
Examplesself.dead

exists

If the pet exists in the battle.

Returnbool
Examplesself.exists

is

If the pet matches a selector.

Returnbool
SelectorsNameIDPosition
Examplesself.is(Chrominius)self.is(1152)self.is(#2)

played

If the pet has been played.

Returnbool
Examplesself.played

Battle

weather

If a weather effect is currently active.

SelectorsNameID
Returnbool
Examplesweather(Moonlight)weather(#596)

weather.duration

The number of turns remaining for a weather effect.

Returnvalue
Examplesweather(Moonlight).duration

round

The current round.

Returnvalue
Examplesround

Operations

!

Negation.

TypeUnary
Examples!enemy.hp.full

=

Equality.

TypeBinary
Examplesself.level = 15

!=

Inequality.

TypeBinary
Examplesself.level != 15

>

Greater than.

TypeBinary
Examplesself.level > 15

>=

Greater than or equal to.

TypeBinary
Examplesself.level >= 15

<

Less than.

TypeBinary
Examplesself.level < 15

<=

Less than or equal to.

TypeBinary
Examplesself.level <= 15

~

Contains.

TypeBinary
Examplesweather ~ Mudslide, Scorched Earth, Blizzard

!~

Does not contain.

TypeBinary
Examplesweather !~ Mudslide, Scorched Earth, Blizzard

&

Logical AND.

TypeBinary
Examplesweather = Mudslide & self.level = 15

Language

--

Script comment.

Examples-- Hello World!

Families

1 - Humanoid
2 - Dragonkin
3 - Flying
4 - Undead
5 - Critter
6 - Magic
7 - Elemental
8 - Beast
9 - Aquatic
10 - Mechanical

Quality

1 - Poor
2 - Common
3 - Uncommon
4 - Rare

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值