add more gems, next is to add functionality to gems, also need to add way to upgrade gems

This commit is contained in:
koneko 2025-02-04 12:50:02 +01:00
parent 9847b8e47d
commit bfc73d436f
15 changed files with 155 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -39,5 +39,142 @@
"frostfire": 0
}
]
},
{
"name": "Yeti Gem",
"description": "Yeti gem description. Something something, write this while drunk or something.",
"type": "Yeti",
"totalLevels": 2,
"textures": [],
"cantCombineWith": [],
"specialCombine": [],
"genericImprovements": [
{
"damageUp": 2,
"attackSpeedUp": 100,
"rangeUp": 0.5,
"timeToLiveUp": 0,
"pierceUp": 1
},
{
"damageUp": 2,
"attackSpeedUp": 100,
"rangeUp": 0.5,
"timeToLiveUp": 0,
"pierceUp": 1
}
],
"gemResistanceModifications": [
{
"physical": 0,
"divine": 0,
"fire": 0,
"ice": 0,
"frostfire": 0
},
{
"physical": 0,
"divine": 0,
"fire": 0,
"ice": 0,
"frostfire": 0
}
]
},
{
"name": "Titalium Gem",
"description": "Titalium gem description. Something something zombie creeps working for you something something.",
"type": "Titalium",
"totalLevels": 3,
"textures": [],
"cantCombineWith": [],
"specialCombine": [],
"genericImprovements": [
{
"damageUp": 2,
"attackSpeedUp": 100,
"rangeUp": 0.5,
"timeToLiveUp": 0,
"pierceUp": 1
},
{
"damageUp": 2,
"attackSpeedUp": 100,
"rangeUp": 0,
"timeToLiveUp": 0,
"pierceUp": 1
},
{
"damageUp": 2,
"attackSpeedUp": 100,
"rangeUp": 0,
"timeToLiveUp": 0,
"pierceUp": 1
}
],
"gemResistanceModifications": [
{
"physical": 0,
"divine": 0,
"fire": 0,
"ice": 0,
"frostfire": 0
},
{
"physical": 0,
"divine": 0,
"fire": 0,
"ice": 0,
"frostfire": 0
},
{
"physical": 0,
"divine": 0,
"fire": 0,
"ice": 0,
"frostfire": 0
}
]
},
{
"name": "Soulforge Gem",
"description": "Soulforge gem description, have to write later.",
"type": "Soulforge",
"totalLevels": 2,
"textures": [],
"cantCombineWith": [],
"specialCombine": [],
"genericImprovements": [
{
"damageUp": 2,
"attackSpeedUp": 100,
"rangeUp": 0.5,
"timeToLiveUp": 0,
"pierceUp": 1
},
{
"damageUp": 2,
"attackSpeedUp": 100,
"rangeUp": 0.5,
"timeToLiveUp": 0,
"pierceUp": 1
}
],
"gemResistanceModifications": [
{
"physical": 0,
"divine": 0,
"fire": 0,
"ice": 0,
"frostfire": 0
},
{
"physical": 0,
"divine": 0,
"fire": 0,
"ice": 0,
"frostfire": 0
}
]
}
]

View File

@ -33,8 +33,8 @@ export class Engine {
Engine.NotificationManager.Notify('Loaded testing suite.', 'danger');
Engine.TowerManager.ToggleChoosingTowerLocation('RESET');
Engine.TowerManager.PlaceTower(GameAssets.Towers[1], 8, 10, GameAssets.Towers[0].behaviour, true);
for (let i = 0; i < 16; i++) {
this.GameScene.MissionStats.giveGem(new Gem(GemType.Fire), true);
for (let i = 0; i < 29; i++) {
this.GameScene.MissionStats.giveGem(new Gem(i % 4), true);
}
}
}

View File

@ -8,12 +8,15 @@ export default class Gem {
public texture: PIXI.Texture;
public level: number = 1;
public definition: GemDefinition;
public id: number;
constructor(gemType: GemType) {
public id: number | string;
constructor(gemType: GemType, doNotIncrement?: boolean) {
this.definition = GameAssets.Gems[gemType];
this.texture = this.definition.textures[0];
if (!doNotIncrement) {
this.id = latestGemId + 1;
latestGemId++;
} else this.id = '';
}
public currentGemImprovement() {
let totalGemImprovement: GenericGemImprovement = {

View File

@ -50,9 +50,9 @@ export default class MissionStats extends GameObject {
}
public giveGem(gem: Gem, noNotify?) {
if (this.inventory.length >= 48)
if (this.inventory.length >= 32)
return Engine.NotificationManager.Notify(
"Can't hold more than 48 Gems. Extra Gem was thrown away.",
"Can't hold more than 32 Gems. Extra Gem was thrown away.",
'danger'
);
this.inventory.push(gem);

View File

@ -24,7 +24,7 @@ function projectileCheck(tower: Tower, elapsedMS: number) {
*
* @param tower - The tower whose damage is being computed.
*/
export function computeDamage(tower: Tower) {
export function computeGemImprovements(tower: Tower) {
let gemDamage = 0;
tower.slottedGems.forEach((gem) => {
gemDamage += gem.currentGemImprovement().damageUp;
@ -40,7 +40,7 @@ export function computeDamage(tower: Tower) {
* @param elapsedMS - The elapsed time in milliseconds since the last update.
*/
export function BasicTowerBehaviour(tower: Tower, elapsedMS: number) {
computeDamage(tower);
if (tower.ticksUntilNextShot % 2 == 0) computeGemImprovements(tower);
projectileCheck(tower, elapsedMS);
if (tower.ticksUntilNextShot > 0) tower.ticksUntilNextShot--;
let creepsInRange = tower.GetCreepsInRange();

View File

@ -32,7 +32,7 @@ export default class GemTab extends GuiObject {
this.gemTabSprite.x = 0;
this.gemTabSprite.y = 0;
this.gemTabSprite.width = this.bounds.width;
this.gemTabSprite.height = this.bounds.height;
this.gemTabSprite.height = this.bounds.height - 255;
this.container.addChild(this.gemTabSprite);
Engine.app.canvas.addEventListener('pointermove', () => {
this.pointerMoveEvent();

View File

@ -7,7 +7,7 @@ import Button, { ButtonTexture } from './Button';
import { Tower } from '../game/Tower';
import Gem from '../game/Gem';
import { GemEvents } from '../Events';
import { computeDamage } from '../game/TowerBehaviours';
import { computeGemImprovements } from '../game/TowerBehaviours';
export class VisualGemSlot extends GuiObject {
public iconSprite: PIXI.Sprite;
@ -220,7 +220,7 @@ export default class TowerPanel extends GuiObject {
}
public Show(tower: Tower) {
this.isShown = true;
computeDamage(tower);
computeGemImprovements(tower);
this.SetContent(tower);
this.MakeSlots(tower);
this.showingTower = tower;

View File

@ -213,7 +213,7 @@ export class GameScene extends Scene {
// offerText.x -= offerText.width;
Engine.GameMaster.currentScene.stage.addChildAt(offerText, 0);
gemsToOffer.forEach((gType, index) => {
let _Gem = new Gem(gType);
let _Gem = new Gem(gType, true);
let vGem = new VisualGemSlot(0, Engine.app.stage, _Gem);
this.visualGems.push(vGem);
vGem.container.x = this.offerGemsSprite.x - 15 + 69 * (index + 1);
@ -228,7 +228,7 @@ export class GameScene extends Scene {
vGem.onClick = () => {
Engine.GameScene.tooltip.Hide();
offerText.destroy();
this.PlayerPickedGem(_Gem);
this.PlayerPickedGem(new Gem(gType));
};
});
}