Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add pets #30

Merged
merged 22 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1d2fee4
Merge branch 'main' of https://github.com/decentraland-scenes/Antrom-RPG
Gaffomdz Jul 3, 2024
2334c40
Merge branch 'main' of https://github.com/decentraland-scenes/Antrom-RPG
Gaffomdz Jul 4, 2024
052f585
Merge branch 'main' of https://github.com/decentraland-scenes/Antrom-RPG
Gaffomdz Jul 8, 2024
08b0494
Merge branch 'main' of https://github.com/decentraland-scenes/Antrom-RPG
Gaffomdz Jul 15, 2024
c7099fd
Merge branch 'main' of https://github.com/decentraland-scenes/Antrom-RPG
Gaffomdz Jul 19, 2024
a1382af
Merge branch 'main' of https://github.com/decentraland-scenes/Antrom-RPG
Gaffomdz Jul 23, 2024
b83673b
Merge branch 'main' of https://github.com/decentraland-scenes/Antrom-RPG
Gaffomdz Jul 23, 2024
e8e3867
feat: autoBattle, DesertDungeon and MinersCave added
Gaffomdz Jul 30, 2024
3a768a3
fix: pigs and chicken attack fix
Gaffomdz Jul 30, 2024
2cb95f7
prettier
Gaffomdz Jul 30, 2024
d9a1fc4
fix: butcher removeEntity update
Gaffomdz Jul 30, 2024
6bd87a4
prettier
Gaffomdz Jul 30, 2024
18ee4c4
feat: added correct values for dungeons
Gaffomdz Aug 1, 2024
413aa73
Added pet functionality
Gaffomdz Aug 2, 2024
2e70403
Merge branch 'main' of https://github.com/decentraland-scenes/Antrom-RPG
Gaffomdz Aug 2, 2024
599380c
Update package.json
Gaffomdz Aug 2, 2024
dacce99
Merge branch 'main' into feat/add-pets
Gaffomdz Aug 2, 2024
23f079a
feat: plug companion creation to ui
Gaffomdz Aug 2, 2024
29ca4d9
prettier
Gaffomdz Aug 2, 2024
1a5d006
fix: duplicated pets fixed
Gaffomdz Aug 5, 2024
ed94410
prettier
Gaffomdz Aug 5, 2024
14cbebd
fix: remove dead code and typing issues
Gaffomdz Aug 6, 2024
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
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion scene/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
"fp-future": "^1.0.1",
"typescript": "^5.3.2"
}
}
}
3 changes: 2 additions & 1 deletion scene/src/controllers/main-hud/inventory.controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
type CompanionType
} from '../../ui/inventory/companionsData'
import { type ProfessionType } from '../../ui/inventory/professionsData'
import { equipCompanion } from '../../inventory/equipCompanion'
// import { WearablesConfig } from '../../player/wearables-config'
// import {type GetPlayerDataRes, getPlayer } from '@dcl/sdk/src/players'

Expand Down Expand Up @@ -481,7 +482,7 @@ export class InventoryController {
this.componionButtonSprite =
companionPageSprite.equip_button_when_clicked
// execute function equip companion
console.log('equip')
equipCompanion(this.selectedCompanion.name)
this.equipedCompanion = this.selectedCompanion
} else {
this.componionButtonSprite = companionPageSprite.Purchase_while_clicked
Expand Down
6 changes: 3 additions & 3 deletions scene/src/controllers/realm.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class RealmController {
this.gameController = gameController
}

switchRealm(realm: RealmType): void {
switchRealm(realm: RealmType, difficulty: string): void {
leanmendoza marked this conversation as resolved.
Show resolved Hide resolved
this.cleanUpScene()

// TODO: utils and npc library should be cleaned as well
Expand All @@ -29,13 +29,13 @@ export class RealmController {
this.currentRealm = new DemonKingDungeon(this.gameController)
break
case 'dungeon':
this.currentRealm = new Dungeon(this.gameController)
this.currentRealm = new Dungeon(this.gameController, difficulty)
break
case 'dungeonBase':
this.currentRealm = new DungeonBase(this.gameController)
break
case 'minersCave':
this.currentRealm = new MinersCave(this.gameController)
this.currentRealm = new MinersCave(this.gameController, difficulty)
break
}
}
Expand Down
5 changes: 5 additions & 0 deletions scene/src/controllers/ui.controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { LoadingUI } from '../ui/loading/loading'
import { CreationPlayerController } from './creation-player.controller'
import { type GameController } from './game.controller'
import { MainHudController } from './main-hud'
import { type RealmType } from '../realms/types'

export class UIController {
loadingUI: LoadingUI
Expand Down Expand Up @@ -53,6 +54,10 @@ export class UIController {
this.mainHud = new MainHudController()
}

loadRealm(realm: RealmType, difficulty: string): void {
this.gameController.realmController.switchRealm(realm, difficulty)
}

displayAnnouncement(
announcement: string,
color: Color4 = Color4.Yellow(),
Expand Down
2 changes: 2 additions & 0 deletions scene/src/counters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ export const jailGuards = new UICounter()
export const jailOpenOnce = new UICounter()
export const demonKill = new UICounter()
export const DungeonStage = new UICounter()
export const desertDungeonMonsterCount = new UICounter()
export const caveDungeonMonsterCount = new UICounter()

demonKill.set(1)
6 changes: 3 additions & 3 deletions scene/src/enemies/Executioner.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { Transform } from '@dcl/sdk/ecs'
import { Color4, Quaternion, Vector3 } from '@dcl/sdk/math'
import MonsterMob from './MonsterMob'
import { LEVEL_TYPES } from '../player/LevelManager'
import { Player } from '../player/player'
import { BannerType } from '../ui/banner/bannerConstants'
import { ITEM_TYPES } from '../inventory/playerInventoryMap'
import { entityController } from '../realms/entityController'
import MonsterMobAuto from './monsterMobAuto'

function getRandomIntRange(min: number, max: number): number {
min = Math.ceil(min)
max = Math.floor(max)
return Math.floor(Math.random() * (max - min + 1)) + min
}

export default class Executioner extends MonsterMob {
export default class Executioner extends MonsterMobAuto {
shapeFile = 'assets/models/ExecutionerAxe.glb'
hoverText: string

constructor() {
const player = Player.getInstanceOrNull()
const level = player?.levels.getLevel(LEVEL_TYPES.PLAYER) ?? 1
const level = player?.levels.getLevel(LEVEL_TYPES.PLAYER) ?? 2
super(level + 20, level + 60, level - 10, level * 100)
this.minLuck = 10
this.hoverText = `Attack LVL ${level} Executioner!`
Expand Down
132 changes: 132 additions & 0 deletions scene/src/enemies/ExecutionerCaveDungeon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import { Color4, Quaternion, Vector3 } from '@dcl/sdk/math'
import { LEVEL_TYPES } from '../player/LevelManager'
import MonsterMob from './MonsterMob'
import { Player } from '../player/player'
import { type GameController } from '../controllers/game.controller'
import { DungeonStage, caveDungeonMonsterCount } from '../counters'
import { Transform } from '@dcl/sdk/ecs'
import { getRandomInt, getRandomIntRange } from '../utils/getRandomInt'
import { ITEM_TYPES } from '../inventory/playerInventoryMap'

export default class ExecutionerCaveDungeon extends MonsterMob {
shapeFile = 'assets/models/RockMonster.glb'
hoverText = `Attack Metapsammite Disciple!`

gameController: GameController
constructor(gameController: GameController, initialPos: Vector3) {
const player = Player.getInstanceOrNull()
const level = player?.levels.getLevel(LEVEL_TYPES.PLAYER) ?? 1
const stage = DungeonStage.read()
super(5 + stage * 7, level + 100, level + 1, 10)
this.gameController = gameController
this.minLuck = 20

Transform.createOrReplace(this.entity, {
position: Vector3.create(0, 0, 0)
})
this.initMonster()
super.setupEngageTriggerBox()
this.loadTransformation(initialPos)
this.setTopOffset(2.25)
this.dropRate = -2
}

onDropXp(): void {
const xp = getRandomIntRange(this.xp, this.xp + 10)
console.log(xp)
caveDungeonMonsterCount.increase(1)
this.gameController.uiController.displayAnnouncement(
`${caveDungeonMonsterCount.read()}`
)
// ui.displayAnnouncement(`${easyDungeonMonsterCount1.read()}`)

if (caveDungeonMonsterCount.read() === 6) {
this.gameController.uiController.displayAnnouncement(
'Cube Removed!',
Color4.Yellow(),
2000
)
if (
this.gameController.realmController.currentRealm?.removeSingleEntity !==
undefined
) {
// remove cube 1 and 2
}

if (caveDungeonMonsterCount.read() === 21) {
this.gameController.uiController.displayAnnouncement(
'Cube Removed!',
Color4.Yellow(),
2000
)
if (
this.gameController.realmController.currentRealm
?.removeSingleEntity !== undefined
) {
// Remove cube 3
}
}

if (caveDungeonMonsterCount.read() === 27) {
this.gameController.uiController.displayAnnouncement(
'Cube Removed!',
Color4.Yellow(),
2000
)
if (
this.gameController.realmController.currentRealm
?.removeSingleEntity !== undefined
) {
// Remove cube 4
}
}

const exp = [
{
type: LEVEL_TYPES.ENEMY,
value: 1
},
{
type: LEVEL_TYPES.PLAYER,
value: xp
}
]
const loot = [
{
type: ITEM_TYPES.BONE,
value: 1
}
]
console.log(exp, loot)
// UI ? addRewards(exp, loot)
// DailyQuestHUD.getInstance().listenAndUpdateForAnyActiveQuest(
// LEVEL_TYPES.ENEMY
// )
}
}

onDropLoot(): void {}

setupAttackTriggerBox(): void {
super.setupAttackTriggerBox()
}

create(): void {}

loadTransformation(initialPos: Vector3): void {
const initialPosition = Vector3.create(
initialPos.x,
initialPos.y,
initialPos.z
)
const initialRotation = Quaternion.fromEulerDegrees(
0,
getRandomInt(10) / 10 + getRandomInt(4),
0
)
Transform.createOrReplace(this.entity, {
position: initialPosition,
rotation: initialRotation
})
}
}
Loading
Loading