Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"solidity.compileUsingRemoteVersion": "latest"
"solidity.compileUsingRemoteVersion": "v0.8.26+commit.8a97fa7a"
}
3 changes: 3 additions & 0 deletions packages/contracts/constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ string constant ERC721_SYMBOL = "UDC";
string constant TOKEN_URI = "ipfs://";

uint256 constant DEFAULT_MAX_TURNS = 15;
uint256 constant TO_HIT_MODIFIER = 10_000;
uint256 constant DEFENSE_MODIFIER = 10_000;
uint256 constant ATTACK_MODIFIER = 10_000;
111 changes: 65 additions & 46 deletions packages/contracts/mud.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export default defineWorld({
MobType: ["Monster", "NPC"],
Alignment: ["Loyalist", "Neutral", "Rebel", "Aggro"],
EncounterType: ["PvP", "PvE"],
SkillType: ["PhysicalAttack", "MagicAttack", "StatusEffect"],
SkillType: ["Temporary", "PhysicalAttack", "MagicAttack", "StatusEffect"],
StatusEffects: ["ToHitModifier", "DoT", "HitPointMod", "ArmorMod", "WeaponMod", "Stun"],
},
tables: {
/**
Expand All @@ -28,64 +29,52 @@ export default defineWorld({
Characters: {
key: ["characterId"],
schema: {
characterId: "bytes32",
owner: "address",
characterId: "uint256",
class: "Classes",
name: "bytes32",
locked: "bool",
},
},
CharacterStats: {
key: ["characterId"],
Stats: {
key: ["entityId"],
schema: {
characterId: "uint256",
entityId: "bytes32",
strength: "uint256",
agility: "uint256",
intelligence: "uint256",
hitPoints: "uint256",
damageTaken: "int256",
maxHitPoints: "uint256",
currentDamage: "int256",
experience: "uint256",
level: "uint256",
armor: "uint256",
},
},
MapConfig: {
key: [],
schema: {
height: "uint32",
width: "uint32",
},
codegen: {
dataStruct: false,
},
},
Position: {
key: ["characterId"],
schema: {
characterId: "uint256",
x: "uint32",
y: "uint32",
height: "uint16",
width: "uint16",
},
codegen: {
dataStruct: false,
},
},
Spawned: {
key: ["characterId"],
key: ["entityId"],
schema: {
characterId: "uint256",
entityId: "bytes32",
spawned: "bool",
},
},
MobStats: {
key: ["entityId"],
Mobs: {
schema: {
entityId: "bytes32",
strength: "uint256",
agility: "uint256",
intelligence: "uint256",
hitPoints: "uint256",
damageTaken: "int256",
experience: "uint256",
mobId: "uint256",
mobType: "MobType",
mobStats: "bytes",
mobMetadata: "string",
},
key: ["mobId"],
},
Levels: {
key: ["level"],
Expand All @@ -97,18 +86,24 @@ export default defineWorld({
CharacterEquipment: {
key: ["characterId"],
schema: {
characterId: "uint256",
characterId: "bytes32",
strBonus: "int256",
agiBonus: "int256",
intBonus: "int256",
hpBonus: "int256",
equippedArmor: "uint256[]",
equippedWeapons: "uint256[]",
equippedSpells: "uint256[]",
equippedSpells: "bytes32[]",
equippedSkills: "bytes32[]",
},
},
Counters: {
schema: {
contractAddress: "address",
mobId: "uint256",
counter: "uint256",
},
key: ["contractAddress"],
key: ["contractAddress", "mobId"],
},
Items: {
schema: {
Expand All @@ -118,15 +113,15 @@ export default defineWorld({
},
key: ["itemId"],
},
Mobs: {
Skills: {
schema: {
mobId: "uint256",
mobType: "MobType",
mobStats: "bytes",
mobMetadata: "string",
skillId: "bytes32",
skillType: "SkillType",
skillStats: "bytes",
},
key: ["mobId"],
key: ["skillId"],
},

StarterItems: {
key: ["class"],
schema: {
Expand Down Expand Up @@ -162,18 +157,20 @@ export default defineWorld({
// array of monsterIds if pve playerIds if pvp
defenders: "bytes32[]",
// array of playerIds
attackers: "uint256[]",
attackers: "bytes32[]",
},
key: ["encounterId"],
},
MobEntity: {
key: ["mobEntityId"],
// when an entity starts combat it creates a "match entity" for that encounter.
//when combat ends, the encounterId is set to zero, and the damage taken subtracted from the entities hp.
MatchEntity: {
key: ["matchEntityId"],
schema: {
mobEntityId: "bytes32",
remainingHp: "int256",
// by default this is bytes(0), if this mob is in an encounter it will be set,
matchEntityId: "bytes32",
// by default this is bytes(0), if this entity is in an encounter it will be set,
// if the mob survives its encounter this will be set back to bytes(0)
encounterId: "bytes32",
damageTaken: "int256",
},
},
RandomNumbers: {
Expand All @@ -184,6 +181,28 @@ export default defineWorld({
arbitraryData: "bytes",
},
},
/**
* The position of an entity.
*/
Position: {
key: ["entity"],
codegen: {
dataStruct: false,
},
schema: {
entity: "bytes32",
x: "uint16",
y: "uint16",
},
},
EntitiesAtPosition: {
key: ["x", "y"],
schema: {
x: "uint16",
y: "uint16",
entities: "bytes32[]",
},
},
/**
* UltimateDominion settings:
* - locked - If true, game settings are locked.
Expand Down
Loading