This commit is contained in:
vesta 2025-08-29 21:22:40 +02:00
parent 1d1dde9d49
commit f001d8295c

View file

@ -1,5 +1,4 @@
const Biome = {
<<<<<<< HEAD
WATER_DEEP: { acceptStructure:false, movements:['swim'], affinities:[('water',0.8),('dark',0.2)], name: 'Eau Profonde', winterColor: '#3D5A80', fallColor: '#3D5A80', summerColor: '#3D5A80', autumnColor: '#3D5A80',maxElevation:-1,minElevation:-4 },
WATER_SHALLOW: { acceptStructure:false,movements:['swim','ride','navigate','fly'], affinities:[('water',0.8),('life',0.2)],name: 'Eau Peu Profonde', winterColor: '#97aabdff', fallColor: '#5A8AB8', summerColor: '#5A8AB8', autumnColor: '#5A8AB8',maxElevation:1,minElevation:-2 },
BEACH: { acceptStructure:true, movements:['walk','ride','fly'],affinities:[('sand',0.8),('water',0.2)],name: 'Sable', winterColor: '#E9D9A1', fallColor: '#E9D9A1', summerColor: '#E9D9A1', autumnColor: '#E9D9A1',maxElevation:2 ,minElevation:0 },
@ -13,21 +12,6 @@ const Biome = {
RIVER: { acceptStructure:false,movements:['navigate','swim','fly'],affinities:[('water',0.6),('earth',0.2),('life',0.2)],name: 'Rivière', winterColor: '#97aabdff', fallColor: '#5A8AB8', summerColor: '#5A8AB8', autumnColor: '#5A8AB8',maxElevation:2,minElevation:-2 },
SWAMP: { acceptStructure:false, movements:['fly'],affinities:[('water',0.6),('earth',0.2),('dark',0.2)],name: 'Marais', winterColor: '#0b2e10ff', fallColor: '#0b2e10ff', summerColor: '#0b2e10ff', autumnColor: '#0b2e10ff',maxElevation:1,minElevation:-1 }
=======
WATER_DEEP: { acceptStructure:false, movements:['swim'], affinities:[('water',0.8),('dark',0.2)], name: 'Eau Profonde', winterColor: '#3D5A80', fallColor: '#3D5A80', summerColor: '#3D5A80', autumnColor: '#3D5A80',maxElevation:-1,minElevation:-4 },
WATER_SHALLOW: { acceptStructure:false,movements:['swim','ride','navigate','fly'], affinities:[('water',0.8),('life',0.2)],name: 'Eau Peu Profonde', winterColor: '#97aabdff', fallColor: '#5A8AB8', summerColor: '#5A8AB8', autumnColor: '#5A8AB8',maxElevation:1,minElevation:-2 },
BEACH: { acceptStructure:true, movements:['walk','ride','fly'],affinities:[('sand',0.8),('water',0.2)],name: 'Sable', winterColor: '#E9D9A1', fallColor: '#E9D9A1', summerColor: '#E9D9A1', autumnColor: '#E9D9A1',maxElevation:2 ,minElevation:0 },
GRASSLAND: { acceptStructure:true, movements:['walk','ride','fly'],affinities:[('life',0.6),('earth',0.2)],name: 'Plaine', winterColor: '#ecf1e3ff', fallColor: '#98C159', summerColor: '#a5a450ff', autumnColor: '#455e21ff',maxElevation:3,minElevation:-1 },
FOREST: { acceptStructure:true,movements:['walk','ride','fly'],affinities:[('wood',0.6),('earth',0.4)], name: 'Forêt', winterColor: '#92ac83ff', fallColor: '#21a32cff', summerColor: '#6A994E', autumnColor: '#b88a28ff',maxElevation:3,minElevation:0 },
ENCHANTED_FOREST: { acceptStructure:true,movements:['walk','ride','fly'],affinities:[('wood',0.8),('dark',0.2)('life',0.2)], name: 'Forêt Enchantée', winterColor: '#7B6094', fallColor: '#7B6094', summerColor: '#7B6094', autumnColor: '#7B6094',maxElevation:3,minElevation:0 },
MOUNTAIN: { acceptStructure:false, movements:['climb','fly'],affinities:[('rock',0.6),('wind',0.4)],name: 'Montagne', winterColor: '#F7F7F7', fallColor: '#A9A9A9', summerColor: '#A9A9A9', autumnColor: '#A9A9A9',maxElevation:4,minElevation:3 },
SNOWLAND: { acceptStructure:true,movements:['walk','ride','fly'], affinities:[('ice',0.8),('earth',0.2)],name: 'Toundra', winterColor: '#F7F7F7', fallColor: '#F7F7F7', summerColor: '#F7F7F7', autumnColor: '#F7F7F7',maxElevation:2,minElevation:-1 },
SNOWMOUNTAIN: { acceptStructure:false, movements:['climb','fly'],affinities:[('ice',0.4),('rock',0.4),('wind',0.2)],name: 'Mont enneigé', winterColor: '#F7F7F7', fallColor: '#F7F7F7', summerColor: '#F7F7F7', autumnColor: '#F7F7F7',maxElevation:4,minElevation:3 },
DESERT: { acceptStructure:true,movements:['walk','ride','fly'],affinities:[('sand',0.8),('life',0.1),('fire',0.1)], name: 'Désert', winterColor: '#D4A373', fallColor: '#D4A373', summerColor: '#D4A373', autumnColor: '#D4A373',maxElevation:2,minElevation:0 },
RIVER: { acceptStructure:false,movements:['navigate','swim','fly'],affinities:[('water',0.6),('earth',0.2),('life',0.2)],name: 'Rivière', winterColor: '#97aabdff', fallColor: '#5A8AB8', summerColor: '#5A8AB8', autumnColor: '#5A8AB8',maxElevation:2,minElevation:-2 },
SWAMP: { acceptStructure:false, movements:['fly'],affinities:[('water',0.6),('earth',0.2),('dark',0.2)],name: 'Marais', winterColor: '#0b2e10ff', fallColor: '#0b2e10ff', summerColor: '#0b2e10ff', autumnColor: '#0b2e10ff',maxElevation:1,minElevation:-1 }
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
}
const NAME_PREFIXES = ["Chêne", "Sombre", "Pierre", "Haut", "Val", "Mur", "Guet", "Clair"];
const NAME_SUFFIXES = ["bourg", "fort", "ville", "mont", "port", "bois", "rivage", "gard"];
@ -39,35 +23,6 @@ const RACE = {
};
<<<<<<< HEAD
const Affinities = ['water', 'fire', 'sand', 'rock', 'dark', 'life', 'ice', 'wood', 'wind', 'metal', 'time', 'space', 'lava', 'light', 'spirit']
const Slot = ['head', 'body', 'leg', 'foot', 'right-hand', 'left-hand', 'two-hands', 'finger1', 'finger2', 'neck', 'purse', 'backpack', 'belt1', 'belt2']
const ItemType = {
lightWeapon: { slot: ('right-hand', 'left-hand', 'backpack'), soul: true, enchant: true },
heavyWeapon: { slot: ('two-hands', 'backpack'), soul: true, enchant: true },
heavyArmor: { slot: ('body', 'backpack'), soul: true, enchant: true },
lightArmor: { slot: ('body', 'backpack'), soul: true, enchant: true },
shield: { slot: ('right-hand', 'left-hand', 'backpack'), soul: true, enchant: true },
shoes: { slot: ('foot', 'backpack'), soul: true, enchant: true },
pant: { slot: ('leg', 'backpack'), soul: true, enchant: true },
helmet: { slot: ('leg', 'backpack'), soul: true, enchant: true },
potion: { slot: ('heal', 'backpack'), soul: false, enchant: false },
throwable: { slot: ('belt', 'backpack'), soul: true, enchant: true },
craftMaterial: { slot: ('right-hand', 'left-hand', 'backpack'), soul: false, enchant: false },
ring: { slot: ('finger1', 'finger2', 'backpack'), soul: true, enchant: true },
amulet: { slot: ('neck', 'backpack'), soul: true, enchant: true },
currency: { slot: ('purse'), soul: true, enchant: true },
enchantMaterial: { slot: ('backpack'), soul: false, enchant: false },
mercantMaterial: { slot: ('backpack'), soul: false, enchant: false }
}
const Items = {
'Épée en Bois': { name: 'Épée en Bois', itemType: 'lightWeapon', stats: { strength: 2 }, icon: '🗡️', enchantments: [] },
'Armure de Cuir': { name: 'Armure de Cuir', itemType: 'lightArmor', stats: { vitality: 2 }, icon: '🧥', enchantments: [] },
'Claymore': { name: 'Claymore', itemType: 'lightArmor', stats: { vitality: 2 }, icon: '🧥', enchantments: ['primal'], soul: new soul('cleaver', 'test') }
=======
const Slot = ['head','body','leg','foot','right-hand','left-hand','two-hands','finger1','finger2','neck','purse','backpack','belt1','belt2'];
@ -100,21 +55,14 @@ const Items = {
'Fer': { name: 'Fer', itemType: 'craftMaterial', icon: '🔩',biome:['MOUNTAIN'],occurence:0.001},
'Mushroom': { name: 'Champignons', itemType: 'craftMaterial', icon: '🍄',biome:['FOREST'],occurence:0.01},
'gold': { name: 'Champignons', itemType: 'mercantMaterial', icon: '💰',biome:['MOUNTAIN','RIVER'],occurence:0.001}
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
};
const StructureType = {
<<<<<<< HEAD
'Épée en Bois': { name: 'Épée en Bois', itemType: 'lightWeapon', stats: { strength: 2 }, icon: '🗡️', enchantments: [] },
'Armure de Cuir': { name: 'Armure de Cuir', itemType: 'lightArmor', stats: { vitality: 2 }, icon: '🧥', enchantments: [] },
'Claymore': { name: 'Claymore', itemType: 'lightArmor', stats: { vitality: 2 }, icon: '🧥', enchantments: ['primal'], soul: new soul('cleaver', 'test') }
=======
TOWN: { name: 'Ville', population:15, icon: '🗡️', occurence:0.001,design: `<svg width="0" height="0" style="position:absolute; display: none;"> <defs> <g id="city-svg" viewBox="0 0 100 100"> <defs> <linearGradient id="stoneGradient" x1="0%" y1="0%" x2="0%" y2="100%"> <stop offset="0%" style="stop-color:#A9A9A9;" /> <stop offset="100%" style="stop-color:#696969;" /> </linearGradient> <linearGradient id="stoneShadowGradient" x1="0%" y1="0%" x2="0%" y2="100%"> <stop offset="0%" style="stop-color:#808080;" /> <stop offset="100%" style="stop-color:#4A5568;" /> </linearGradient> </defs> <!-- Muraille --> <path d="M 10 95 L 15 70 L 85 70 L 90 95 Z" fill="url(#stoneShadowGradient)" stroke="#1A202C" stroke-width="2" /> <!-- Crénaux muraille --> <path d="M 15 70 L 15 65 L 25 65 L 25 70 L 35 70 L 35 65 L 45 65 L 45 70 L 55 70 L 55 65 L 65 65 L 65 70 L 75 70 L 75 65 L 85 65 L 85 70 Z" fill="url(#stoneShadowGradient)" stroke="#1A202C" stroke-width="1.5"/> <!-- Tour gauche --> <rect x="20" y="30" width="20" height="40" fill="url(#stoneGradient)" stroke="#1A202C" stroke-width="2"/> <rect x="18" y="25" width="24" height="5" fill="url(#stoneGradient)" stroke="#1A202C" stroke-width="2"/> <!-- Tour droite --> <rect x="60" y="30" width="20" height="40" fill="url(#stoneGradient)" stroke="#1A202C" stroke-width="2"/> <rect x="58" y="25" width="24" height="5" fill="url(#stoneGradient)" stroke="#1A202C" stroke-width="2"/> <!-- Donjon central --> <rect x="40" y="15" width="20" height="55" fill="url(#stoneGradient)" stroke="#1A202C" stroke-width="2"/> <path d="M 38 15 L 38 10 L 43 10 L 43 15 L 48 15 L 48 10 L 53 10 L 53 15 L 58 15 L 58 10 L 63 10 L 63 15 Z" fill="url(#stoneGradient)" stroke="#1A202C" stroke-width="1.5"/> </g> </defs> </svg>`},
VILLAGE: { name: 'Village', population:5, icon: '🗡️',occurence:0.005, design: `<svg width="0" height="0" style="position:absolute; display: none;"> <defs> <!-- Définition du Village --> <g id="village-svg" viewBox="0 0 100 100"> <defs> <linearGradient id="woodGradient" x1="0%" y1="0%" x2="0%" y2="100%"> <stop offset="0%" style="stop-color:#A0522D;" /> <stop offset="100%" style="stop-color:#8B4513;" /> </linearGradient> <linearGradient id="thatchGradient" x1="0%" y1="0%" x2="0%" y2="100%"> <stop offset="0%" style="stop-color:#D4A373;" /> <stop offset="100%" style="stop-color:#A0522D;" /> </linearGradient> </defs> <!-- Maison principale --> <rect x="20" y="50" width="60" height="45" fill="url(#woodGradient)" stroke="#1A202C" stroke-width="2"/> <polygon points="15,50 85,50 50,20" fill="url(#thatchGradient)" stroke="#1A202C" stroke-width="2"/> <!-- Petite maison derrière --> <rect x="65" y="60" width="25" height="35" fill="#8B4513" stroke="#1A202C" stroke-width="1.5"/> <polygon points="62,60 93,60 77.5,40" fill="#A0522D" stroke="#1A202C" stroke-width="1.5"/> <!-- Fenêtre --> <rect x="45" y="65" width="10" height="10" fill="#2D3748"/> </g> </defs> </svg>`},
FARM: { name: 'Ferme', population:5, icon: '🗡️',occurence:0.010 },
CAMP:{ name: 'Campement', population:2, icon: '⛺',occurence:0.002 },
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
};
const MONSTER_TYPES = {
@ -123,35 +71,6 @@ const MONSTER_TYPES = {
};
const ANIMAL_TYPES = {
<<<<<<< HEAD
WOLF: { name: 'Loup', icon: '🐺', hp: 20, strength: 4, xp: 15, loot: { 'Cuir': 1, 'Os': 1 } },
BOAR: { name: 'Sanglier', icon: '🐗', hp: 25, strength: 5, xp: 20, loot: { 'Cuir': 2 } },
};
class world {
constructor() {
this.x = x;
this.y = y;
this.h = h;
}
setPosition(x, y, z) {
this.x = x;
this.y = y;
this.h = h;
}
getPosition() {
return { x: this.x, y: this.y, z: this.z };
}
// Méthode de l'objet
}
class position {
constructor(x, y, z) {
=======
WOLF: { name: 'Loup', icon: '🐺', hp: 20, strength: 4, xp: 15, loot: { 'Cuir': 1, 'Os': 1 }, design: `<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="wolfFurGradient" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#4A5568;" /><stop offset="100%" style="stop-color:#2D3748;" /></linearGradient><linearGradient id="wolfShadowGradient" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#2D3748;" /><stop offset="100%" style="stop-color:#1A202C;" /></linearGradient></defs><g><path d="M 50 10 L 90 40 L 80 95 L 20 95 L 10 40 Z" fill="url(#wolfFurGradient)" /><path d="M 50 10 L 70 45 L 50 55 L 30 45 Z" fill="url(#wolfShadowGradient)" /><path d="M 20 95 Q 40 70 50 75 Q 60 70 80 95 L 75 98 L 25 98 Z" fill="#2D3748" /><path d="M 25 42 L 10 20 L 35 30 Z" fill="#4A5568" stroke="#1A202C" stroke-width="1"/><path d="M 75 42 L 90 20 L 65 30 Z" fill="#4A5568" stroke="#1A202C" stroke-width="1"/><path d="M 28 38 L 18 25 L 35 32 Z" fill="#2D3748"/><path d="M 72 38 L 82 25 L 65 32 Z" fill="#2D3748"/><path d="M 50 50 L 65 80 L 50 90 L 35 80 Z" fill="#4A5568" /><path d="M 50 85 L 55 95 L 45 95 Z" fill="black" /><path d="M 35 45 Q 40 42 45 45 Q 40 48 35 45 Z" fill="#FBBF24" /><path d="M 65 45 Q 60 42 55 45 Q 60 48 65 45 Z" fill="#FBBF24" /><circle cx="39" cy="45" r="1" fill="black" /><circle cx="61" cy="45" r="1" fill="black" /><path d="M 18 50 L 10 40 L 25 55 Z" fill="#4A5568" /><path d="M 82 50 L 90 40 L 75 55 Z" fill="#4A5568" /><path d="M 20 65 L 5 55 L 22 70 Z" fill="#4A5568" /><path d="M 80 65 L 95 55 L 78 70 Z" fill="#4A5568" /></g></svg>`},
BOAR: { name: 'Sanglier', icon: '🐗', hp: 25, strength: 5, xp: 20, loot: { 'Cuir': 2 } },
};
@ -160,7 +79,6 @@ class position {
class position {
constructor(x,y,z) {
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
this.x = x;
this.y = y;
this.h = h;
@ -174,8 +92,6 @@ class position {
getPosition() {
return { x: this.x, y: this.y, z: this.z };
}
<<<<<<< HEAD
=======
cartToIso() {
return {
@ -183,18 +99,12 @@ class position {
y: (this.x + this.y) * 16
}
}
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
// Méthode de l'objet
}
class tile {
<<<<<<< HEAD
constructor(position, biome, elevation) {
=======
constructor(position,elevation) {
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
this.position = position;
this.biome = this.setBiome();
this.elevation = this.setElevation();
@ -215,18 +125,6 @@ class tile {
let eRaw = (simplex.noise2D(x * scale, y * scale) + 1) / 2;
let tRaw = (simplex.noise2D(x * scale * 0.8, y * scale * 0.8) + 1) / 2;
let mRaw = (simplex.noise2D(x * scale * 1.5, y * scale * 1.5) + 1) / 2;
<<<<<<< HEAD
if (eRaw < 0.25) biome = BIOMES.WATER_DEEP;
else if (eRaw < 0.3) biome = BIOMES.WATER_SHALLOW;
else if (eRaw < 0.35) biome = BIOMES.SAND;
else if (eRaw > 0.85) biome = BIOMES.SNOW;
else if (eRaw > 0.75) biome = BIOMES.MOUNTAIN;
else {
if (tRaw < 0.3) biome = BIOMES.DESERT;
else if (tRaw > 0.6) biome = (mRaw > 0.7) ? BIOMES.ENCHANTED_FOREST : BIOMES.FOREST;
else biome = BIOMES.GRASSLAND;
=======
if (eRaw < 0.25) this.biome = BIOMES.WATER_DEEP;
else if (eRaw < 0.3) this.biome = BIOMES.WATER_SHALLOW;
@ -295,60 +193,24 @@ class tile {
this.structure = { type: 'city', name: NAME_PREFIXES[Math.floor(rand() * NAME_PREFIXES.length)] + NAME_SUFFIXES[Math.floor(rand() * NAME_SUFFIXES.length)], population: TOWN.population + Math.floor(rand() * 150), buildings: ['Remparts', 'Place Forte (Château)', 'Grand Marché', 'Forge', 'Alchimiste', 'Enchanteur', 'Écurie', 'Ferme', 'Ferme', 'Ferme', 'Ferme', 'Ferme', 'Lieu de Culte', 'Nombreuses Maisons'] };
} else if (structureChance < 0.02 && this.tile.biome.acceptStructure) {
this.structure = { type: 'village', name: NAME_PREFIXES[Math.floor(rand() * NAME_PREFIXES.length)] + NAME_SUFFIXES[Math.floor(rand() * NAME_SUFFIXES.length)], population: VILLAGE.population + Math.floor(rand() * 20), buildings: ['Maison du Chef', 'Marchand', 'Lieu de Culte', 'Ferme', 'Ferme', 'Plusieurs Maisons'] };
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
}
if (!this.tile && this.tile.biome === BIOMES.GRASSLAND && Math.random() < 0.2) {
this.structure={type:'farm', name: 'farm', population: 2, buildings: []}
// npcs.push({ x: nx, y: ny, homeX: loc.x, homeY: loc.y, workX: nx, workY: ny, type: 'farmer', icon: '🧑‍🌾' });
}
}
<<<<<<< HEAD
setExplored(explored) {
this.explored = explored;
}
setElevation() {
this.elevation = Math.floor(Math.random() * (this.biome.maxElevation - this.biome.minElevation + 1) + this.biome.minElevation);
}
setStructure() {
var structureChance = rand();
if (structureChance < 0.005) {
structure = { type: 'city', name: NAME_PREFIXES[Math.floor(rand() * NAME_PREFIXES.length)] + NAME_SUFFIXES[Math.floor(rand() * NAME_SUFFIXES.length)], population: 100 + Math.floor(rand() * 150), buildings: ['Remparts', 'Place Forte (Château)', 'Grand Marché', 'Forge', 'Alchimiste', 'Enchanteur', 'Écurie', 'Ferme', 'Ferme', 'Ferme', 'Ferme', 'Ferme', 'Lieu de Culte', 'Nombreuses Maisons'] };
structureLocations.push({ x, y, type: 'city' });
} else if (structureChance < 0.02) {
structure = { type: 'village', name: NAME_PREFIXES[Math.floor(rand() * NAME_PREFIXES.length)] + NAME_SUFFIXES[Math.floor(rand() * NAME_SUFFIXES.length)], population: 20 + Math.floor(rand() * 20), buildings: ['Maison du Chef', 'Marchand', 'Lieu de Culte', 'Ferme', 'Ferme', 'Plusieurs Maisons'] };
structureLocations.push({ x, y, type: 'village' });
}
if (!this.tile && this.tile.biome === BIOMES.GRASSLAND && Math.random() < 0.2) {
tile.isFarm = true;
tile.farmCrop = null;
tile.farmHarvested = false;
// npcs.push({ x: nx, y: ny, homeX: loc.x, homeY: loc.y, workX: nx, workY: ny, type: 'farmer', icon: '🧑‍🌾' });
}
}
=======
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
}
class map {
constructor(size) {
this.map_size = size;
this.tiles = initializeMap();
}
<<<<<<< HEAD
initializeMap() {
console.time('Map Generation');
const simplex = new SimplexNoise();
mapData = Array(this.map_size).fill(null).map((_, y) => Array(this.map_size).fill(null).map((_, x) => {
}
=======
initializeMap(){
console.time('Map Generation');
const simplex = new SimplexNoise();
this.tiles = Array(size).fill(null).map((_, y) => Array(size).fill(null).map((_, x) => new Tile(new Position(x, y))));
}
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
}
class Time {
constructor() {
@ -359,7 +221,6 @@ class Time {
this.hour = 12;
this.day = true;
}
<<<<<<< HEAD
tick(){
this.hour=(this.hour+1) % 24
@ -373,21 +234,6 @@ class Time {
}
wait(nbrHour){
=======
tick(){
this.hour=(this.hour+1) % 24
if (this.hour==1) this.day=(this.day+1) % 30
if (this.day==1) {this.month=(this.month+1) % 12;}
if (this.month==1) {this.year=(this.year+1); }
if (this.month==6 && this.day==21) {this.season='summer'; }
if (this.month==9 && this.day==21) {this.season='autumn'; }
if (this.month==12 && this.day==21) {this.season='winter'; }
if (this.month==3 && this.day==21) {this.season='fall'; }
}
wait(nbrHour){
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
for (let i = 0; i < nbrHour; i++) {
this.tick();
}
@ -410,11 +256,7 @@ class attributes {
}
class creature {
<<<<<<< HEAD
constructor(name, attributes, level, affinities, name, alignments, position, species, race, hp, items) {
=======
constructor(name,attributes,level,affinities,alignments,tile,species,race,hp,items) {
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
this.name = name;
this.attributes = attributes;
this.level = level;
@ -423,13 +265,6 @@ class creature {
this.alignments = alignments;
this.species = species;
this.race = race;
<<<<<<< HEAD
this.hp = hp;
}
fight() {
=======
this.tile=tile;
this.items=items;
this.hp=hp;
@ -437,7 +272,6 @@ class creature {
fight(){
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
}
// Méthode de l'objet
@ -465,15 +299,6 @@ class npc {
}
class player {
<<<<<<< HEAD
constructor(name, creature, equipments) {
this.creature = creature;
this.equipments = equipments;
}
move(position) {
this.position = position
=======
constructor(creature,equipments) {
this.creature=creature;
this.equipments=equipments;
@ -500,7 +325,6 @@ class player {
ctx.lineWidth = 2;
ctx.stroke();
ctx.restore();
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
}
move(dx, dy) {
const newX = this.position.x + dx;
@ -518,15 +342,9 @@ class player {
rename(name) {
this.name = name;
}
<<<<<<< HEAD
equipItem(item,slot) {
equipment.equip(item,slot);
=======
equipItem(item,slot) {
equipment.equip(item,slot);
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
updateAttribute();
}
}
@ -548,15 +366,10 @@ class resource {
this.resourceType = resourceType;
this.position = position;
}
<<<<<<< HEAD
collect(creature) {
=======
collect(tile){
}
collect(creature){
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
// check if creature can collect
// transfer resulting items creature.items[]=this.resourceType.item
this = null;//end object
@ -565,13 +378,8 @@ class resource {
}
class equipment {
<<<<<<< HEAD
constructor(item,slot) {
=======
constructor(item,slot) {
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
this.item = item;
this.slot = slot;
}
@ -588,27 +396,13 @@ class equipment {
}
}
class soul {
<<<<<<< HEAD
constructor(name,description) {
=======
constructor(name,description) {
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
this.name = name;
this.description = description;
}
// Méthode de l'objet
invoke() {
<<<<<<< HEAD
//replace current equipment
}
}
class item {
constructor(name, duration, itemType) {
=======
//
}
@ -616,17 +410,12 @@ class item {
class item {
constructor(name,duration,itemType) {
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
this.name = name;
if (!Object.values(ItemType).includes(itemType)) {
throw new Error('Item type invalide !');
}
this.itemType = itemType;
<<<<<<< HEAD
if (duration){
=======
if (duration){
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
this.duration = itemType.duration
} else {
this.duration = duration
@ -640,17 +429,10 @@ class item {
destroy() {
this = null;
}
<<<<<<< HEAD
use(){
if (this.duration >1) {
this.duration = this.duration-1
}
=======
use(){
if (this.duration >1) {
this.duration = this.duration-1
}
>>>>>>> 1ece079030882bb9218aa5648cc24f2585c0147a
else {
this.destroy();
}