- Game
- Leaderboards
- Resources
- Docs
Skills
Idle
Do nothing, used to stand in place while you wait for some other event to occur.
return player.idle();Attack
Deal damage to an enemy.
return player.attack(enemy);Move
Move to a new location.
return player.move({ x: 1, y: 0 });Respawn
Discard all of your inventory and equipment, and respawn at a new location.
return player.respawn();Summon Mana
Focus your concentration to refill your available mana.
return player.summonMana();Eat
Eat food to restore your calories. Calories are required to live, but can also heal you or be used to cast some spells.
const { player, items } = heartbeat; const food = Object.values(items).find(item => item.type === 'food'); return player.eat(food.id);Equip Spell
Equip a spell stone from your inventory into the end of your spellbook. You can have a maximum of 15 spells equipped at one time, but can only cast the first X spells, where X is your total spellCount minus 1. Spells equipped to your spellbook still count against your weight.
// spellbook before: ['aid_digestion']; // spellbook after : ['aid_digestion', 'fireball']; return player.equipSpell('fireball');Unequip Spell
Unequip the first spell in your spellbook. This consumes a global cooldown and can change the spells that are available to you quickly.
// spellbook before: ['aid_digestion', 'fireball']; // spellbook after : ['fireball']; return player.unequipSpell();Cast
Cast a spell. Spells typically require mana, but can also have calorie costs.
const { player, units } = heartbeat; const enemy = Object.values(units) .find(unit => unit.type === 'monster'); if (enemy) { return player.cast('fireball', enemy); }Sell
Offer to sell items to another character for copper coins.
const { player, units } = heartbeat; const npc = Object.values(units) .find(unit => unit.type === 'npc'); if (npc) { return player.sell({ items: { snakeMeat: 10, // sell 10 snake meat }, to: npc }); }Buy
Buy items from another character for copper coins.
const { player, units } = heartbeat; const npc = Object.values(units) .find(unit => unit.type === 'npc'); if (npc) { return player.buy({ items: { snakeMeat: 10, // buy 10 snake meat }, from: npc }); }Use
Use an item. This can be a consumable, or an item with a use effect.
// Use a minor health potion to heal yourself // optionally, you can specify a target return player.use('minorHealthPotion');Equip
Equip an item. This can be a weapon, armor, or accessory.
return player.equip('copperSword', 'weapon');Unequip
Unequip an item from your equipment.
return player.unequip('weapon');Set Role
Announce the role that you wish to play in your party.
// import { ROLE } from 'programming-game/types'; return player.setRole(ROLE.healer);Invite to Party
Invite another unit to join your party.
return player.inviteToParty(target.id);Seek Party
Announce to the world that you are looking for a party.
return player.seekParty();Accept Party Invite
Accept a party invite from another unit.
return player.acceptPartyInvite(inviter.id);Decline Party Invite
Decline a party invite from another unit.
return player.declinePartyInvite(inviter.id);Leave Party
Leave your current party.
return player.leaveParty();Craft Item
Craft an item using resources. May require a crafting station or a spell.
const { player, recipes } = heartbeat; const campfireKit = recipes.find(recipe => recipe.output['campfireKit']); return player.craft(campfireKit.id);Use Weapon Skill
Use a weapon skill. This consumes tp.
const { player, units } = heartbeat; const enemy = Object.values(units) .find(unit => unit.type === 'monster'); if (enemy) { return player.useWeaponSkill({ skill: 'doubleSlash', target: enemy }); }Drop Item
Drop an item from your inventory. This item will be lost forever.
return player.drop({ item: item.id, amount: 1, });Set Trade
Announce offers and requests for trades.
return player.setTrade({ buying: { snakeEyes: { quantity: 100, price: 10, // price per item in copper coins } }, selling: { snakeMeat: { quantity: 100, price: 5, // price per item in copper coins } } });Accept Quest
Accept a quest from an NPC.
return player.acceptQuest(npc, 'chicken_chaser');Abandon Quest
Abandon a quest that you've already accepted.
return player.abandonQuest('chicken_chaser');Turn In Quest
Turn in a quest that you've completed.
return player.turnInQuest(npc, 'chicken_chaser');Deposit Items Into Storage
Deposit items into your storage. This allows you to persist items through death, but costs 10 Copper Coins per kg stored per hour.
const { player, units } = heartbeat; const banker = Object.values(units).find(unit => { return unit.type === 'npc' && unit.banker; }); if (banker) { return player.deposit(banker, { copperCoin: 100, }); }Harvest Resources
Harvest resources from the environment.
const { player, gameObjects } = heartbeat; const tree = Object.values(gameObjects).find(object => { return object.type === 'tree'; }); if (tree) { return player.harvest(tree); }Withdraw Items From Storage
Withdraw items from your storage.
const { player, units } = heartbeat; const banker = Object.values(units).find(unit => { return unit.type === 'npc' && unit.banker; }); if (banker) { return player.withdraw(banker, { copperCoin: 100, }); }