akhaliq HF staff commited on
Commit
89d3000
·
verified ·
1 Parent(s): 26b87d7

Upload 8 files

Browse files
Files changed (8) hide show
  1. 162.bundle.js +1 -0
  2. 300.bundle.js +1 -0
  3. 680.bundle.js +1 -0
  4. INSTRUCTIONS.md +1 -0
  5. README.md +1 -10
  6. bundle.js +0 -0
  7. bundle.js.LICENSE.txt +145 -0
  8. index.html +16 -19
162.bundle.js ADDED
@@ -0,0 +1 @@
 
 
1
+ "use strict";(self.webpackChunkpokemon_red_clone=self.webpackChunkpokemon_red_clone||[]).push([[162],{162:(e,t,s)=>{s.r(t),s.d(t,{default:()=>a});class a{constructor(e){this.name=e.name||"MissingNo",this.level=e.level||1,this.type=e.type||"normal",this.secondaryType=e.secondaryType||null,this.stats={hp:e.stats?.hp||10,maxHp:e.stats?.maxHp||10,attack:e.stats?.attack||5,defense:e.stats?.defense||5,speed:e.stats?.speed||5,special:e.stats?.special||5},this.moves=e.moves||[{name:"Tackle",type:"normal",power:40,accuracy:100,pp:35,maxPp:35}],this.exp=e.exp||0,this.expToNextLevel=this.calculateExpToNextLevel(),this.evolution=e.evolution||null,this.evolutionLevel=e.evolutionLevel||null,this.status="normal",this.frontSpriteIndex=e.frontSpriteIndex||0,this.backSpriteIndex=e.backSpriteIndex||0}calculateExpToNextLevel(){return Math.pow(this.level+1,3)}takeDamage(e){return this.stats.hp=Math.max(0,this.stats.hp-e),this.stats.hp}heal(e){return this.stats.hp=Math.min(this.stats.maxHp,this.stats.hp+e),this.stats.hp}useMove(e){if(e<0||e>=this.moves.length)return null;const t=this.moves[e];return t.pp<=0?{success:!1,message:`${this.name} has no PP left for ${t.name}!`}:(t.pp--,100*Math.random()>t.accuracy?{success:!1,message:`${this.name}'s attack missed!`}:{success:!0,move:t,message:`${this.name} used ${t.name}!`})}calculateDamage(e,t){const s=2*this.level/5+2,a=this.stats.attack/t.stats.defense,o=s*e.power*a/50+2,i=this.getTypeEffectiveness(e.type,t.type,t.secondaryType),n=Math.random()<.0625?1.5:1,r=.85+.15*Math.random();return{damage:Math.floor(o*i*n*r),typeEffectiveness:i,isCritical:n>1}}getTypeEffectiveness(e,t,s){const a={normal:{rock:.5,ghost:0},fire:{fire:.5,water:.5,grass:2,ice:2,bug:2,rock:.5,dragon:.5},water:{fire:2,water:.5,grass:.5,ground:2,rock:2,dragon:.5},electric:{water:2,electric:.5,grass:.5,ground:0,flying:2,dragon:.5},grass:{fire:.5,water:2,grass:.5,poison:.5,ground:2,flying:.5,bug:.5,rock:2,dragon:.5},ice:{fire:.5,water:.5,grass:2,ice:.5,ground:2,flying:2,dragon:2},fighting:{normal:2,ice:2,poison:.5,flying:.5,psychic:.5,bug:.5,rock:2,ghost:0},poison:{grass:2,poison:.5,ground:.5,bug:2,rock:.5,ghost:.5},ground:{fire:2,electric:2,grass:.5,poison:2,flying:0,bug:.5,rock:2},flying:{electric:.5,grass:2,fighting:2,bug:2,rock:.5},psychic:{fighting:2,poison:2,psychic:.5},bug:{fire:.5,grass:2,fighting:.5,poison:2,flying:.5,psychic:2,ghost:.5},rock:{fire:2,ice:2,fighting:.5,ground:.5,flying:2,bug:2},ghost:{normal:0,fighting:0,poison:.5,bug:.5,ghost:2},dragon:{dragon:2}};let o=1;return a[e]&&a[e][t]&&(o*=a[e][t]),s&&a[e]&&a[e][s]&&(o*=a[e][s]),o}gainExp(e){return this.exp+=e,this.exp>=this.expToNextLevel&&(this.levelUp(),!0)}levelUp(){return this.level++,this.stats.maxHp+=Math.floor(3*Math.random())+1,this.stats.attack+=Math.floor(2*Math.random())+1,this.stats.defense+=Math.floor(2*Math.random())+1,this.stats.speed+=Math.floor(2*Math.random())+1,this.stats.special+=Math.floor(2*Math.random())+1,this.stats.hp=this.stats.maxHp,this.expToNextLevel=this.calculateExpToNextLevel(),this.evolutionLevel&&this.level>=this.evolutionLevel?{leveledUp:!0,canEvolve:!0,evolution:this.evolution}:{leveledUp:!0,canEvolve:!1}}evolve(){if(!this.evolution)return!1;const e=this.name;return this.name=this.evolution,this.stats.maxHp+=5,this.stats.hp=this.stats.maxHp,this.stats.attack+=3,this.stats.defense+=3,this.stats.speed+=3,this.stats.special+=3,this.evolution=null,this.evolutionLevel=null,{oldName:e,newName:this.name}}static createFromTemplate(e,t){const s=t/e.baseLevel,o={hp:Math.floor(e.baseStats.hp*s),maxHp:Math.floor(e.baseStats.hp*s),attack:Math.floor(e.baseStats.attack*s),defense:Math.floor(e.baseStats.defense*s),speed:Math.floor(e.baseStats.speed*s),special:Math.floor(e.baseStats.special*s)};return new a({name:e.name,level:t,type:e.type,secondaryType:e.secondaryType,stats:o,moves:e.moves,evolution:e.evolution,evolutionLevel:e.evolutionLevel,frontSpriteIndex:e.frontSpriteIndex,backSpriteIndex:e.backSpriteIndex})}}}}]);
300.bundle.js ADDED
@@ -0,0 +1 @@
 
 
1
+ "use strict";(self.webpackChunkpokemon_red_clone=self.webpackChunkpokemon_red_clone||[]).push([[300],{300:(t,e,a)=>{a.r(e),a.d(e,{default:()=>s});class s{constructor(t,e,a,s,i,r){return this.scene=t,this.sprite=t.physics.add.sprite(e,a,s,i),this.sprite.setImmovable(!0),this.data={name:r.name||"NPC",dialog:r.dialog||["..."],facing:r.facing||"down",movementPattern:r.movementPattern||"static",pokemon:r.pokemon||[],isTrainer:r.isTrainer||!1},"static"!==this.data.movementPattern&&(this.movementTimer=t.time.addEvent({delay:2e3,callback:this.moveRandomly,callbackScope:this,loop:!0})),this.updateFrame(),this.sprite.npc=this,this}updateFrame(){switch(this.data.facing){case"left":this.sprite.setFrame(8);break;case"right":this.sprite.setFrame(12);break;case"up":this.sprite.setFrame(4);break;default:this.sprite.setFrame(0)}}moveRandomly(){if("static"===this.data.movementPattern)return;const t=["left","right","up","down","idle"],e=t[Math.floor(Math.random()*t.length)];switch(this.sprite.setVelocity(0),e){case"left":this.sprite.setVelocityX(-50),this.data.facing="left",this.sprite.anims.play("player-walk-left",!0);break;case"right":this.sprite.setVelocityX(50),this.data.facing="right",this.sprite.anims.play("player-walk-right",!0);break;case"up":this.sprite.setVelocityY(-50),this.data.facing="up",this.sprite.anims.play("player-walk-up",!0);break;case"down":this.sprite.setVelocityY(50),this.data.facing="down",this.sprite.anims.play("player-walk-down",!0);break;default:this.sprite.anims.stop(),this.updateFrame()}this.scene.time.delayedCall(500,(()=>{this.sprite.setVelocity(0),this.sprite.anims.stop(),this.updateFrame()}))}facePlayer(t){const e=t.sprite.x-this.sprite.x,a=t.sprite.y-this.sprite.y;Math.abs(e)>Math.abs(a)?this.data.facing=e>0?"right":"left":this.data.facing=a>0?"down":"up",this.updateFrame()}startDialog(t){return this.facePlayer(t),this.data.dialog}startBattle(t){return!(!this.data.isTrainer||0===this.data.pokemon.length)&&{trainerName:this.data.name,pokemon:this.data.pokemon}}}}}]);
680.bundle.js ADDED
@@ -0,0 +1 @@
 
 
1
+ "use strict";(self.webpackChunkpokemon_red_clone=self.webpackChunkpokemon_red_clone||[]).push([[680],{680:(t,i,s)=>{s.r(i),s.d(i,{default:()=>e});class e{constructor(t,i,s,e,a){return this.scene=t,this.sprite=t.physics.add.sprite(i,s,e,a),this.sprite.setCollideWorldBounds(!0),this.sprite.setSize(14,14),this.sprite.setOffset(1,2),this.data={name:"Red",pokemon:[],facing:"down",items:[],badges:0,money:0,isMoving:!1,isRunning:!1,lastPosition:{x:i,y:s}},this.movementSettings={walkSpeed:100,runSpeed:160,gridSize:16,gridMovement:!0},this.sprite.player=this,this}update(t){this.movementSettings.gridSize&&this.movementSettings.gridMovement?this.updateGridMovement(t):this.updateFreeMovement(t),this.sprite.x!==this.data.lastPosition.x||this.sprite.y!==this.data.lastPosition.y?(this.data.isMoving=!0,this.data.lastPosition={x:this.sprite.x,y:this.sprite.y}):this.data.isMoving=!1,t.shift&&t.shift.isDown?this.data.isRunning=!0:this.data.isRunning=!1}updateFreeMovement(t){this.sprite.setVelocity(0);const i=this.data.isRunning?this.movementSettings.runSpeed:this.movementSettings.walkSpeed;t.left.isDown?(this.sprite.setVelocityX(-i),this.sprite.anims.play("player-walk-left",!0),this.data.facing="left"):t.right.isDown?(this.sprite.setVelocityX(i),this.sprite.anims.play("player-walk-right",!0),this.data.facing="right"):t.up.isDown?(this.sprite.setVelocityY(-i),this.sprite.anims.play("player-walk-up",!0),this.data.facing="up"):t.down.isDown?(this.sprite.setVelocityY(i),this.sprite.anims.play("player-walk-down",!0),this.data.facing="down"):(this.sprite.anims.stop(),this.setIdleFrame())}updateGridMovement(t){if(this.isMovingToTarget())return void this.continueGridMovement();this.sprite.setVelocity(0),this.sprite.anims.stop(),this.setIdleFrame();const i=this.data.isRunning?this.movementSettings.runSpeed:this.movementSettings.walkSpeed;t.left.isDown?this.startGridMovement("left",i):t.right.isDown?this.startGridMovement("right",i):t.up.isDown?this.startGridMovement("up",i):t.down.isDown&&this.startGridMovement("down",i)}startGridMovement(t,i){this.data.facing=t;const s=this.getTargetPosition(t);this.canMoveTo(s.x,s.y)?(this.targetPosition=s,this.sprite.anims.play(`player-walk-${t}`,!0),this.scene.physics.moveTo(this.sprite,s.x,s.y,i)):this.setIdleFrame()}continueGridMovement(){Phaser.Math.Distance.Between(this.sprite.x,this.sprite.y,this.targetPosition.x,this.targetPosition.y)<2&&(this.sprite.setVelocity(0),this.sprite.x=this.targetPosition.x,this.sprite.y=this.targetPosition.y,this.targetPosition=null,this.sprite.anims.stop(),this.setIdleFrame())}isMovingToTarget(){return void 0!==this.targetPosition&&null!==this.targetPosition}getTargetPosition(t){const i=this.movementSettings.gridSize;switch(t){case"left":return{x:this.sprite.x-i,y:this.sprite.y};case"right":return{x:this.sprite.x+i,y:this.sprite.y};case"up":return{x:this.sprite.x,y:this.sprite.y-i};case"down":return{x:this.sprite.x,y:this.sprite.y+i};default:return{x:this.sprite.x,y:this.sprite.y}}}canMoveTo(t,i){return!0}setIdleFrame(){switch(this.data.facing){case"left":this.sprite.setFrame(8);break;case"right":this.sprite.setFrame(12);break;case"up":this.sprite.setFrame(4);break;default:this.sprite.setFrame(0)}}getFacingPosition(){const t={x:this.sprite.x,y:this.sprite.y},i=this.movementSettings.gridSize;switch(this.data.facing){case"left":t.x-=i;break;case"right":t.x+=i;break;case"up":t.y-=i;break;case"down":t.y+=i}return t}addPokemon(t){this.data.pokemon.push(t)}addItem(t){this.data.items.push(t)}addBadge(){this.data.badges++}addMoney(t){this.data.money+=t}}}}]);
INSTRUCTIONS.md ADDED
@@ -0,0 +1 @@
 
 
1
+ # How to Run\n\n1. Unzip this file\n2. Open index.html in your browser\n\nEnjoy playing Pokémon Red Clone!
README.md CHANGED
@@ -1,10 +1 @@
1
- ---
2
- title: Pokemon
3
- emoji: 🐨
4
- colorFrom: indigo
5
- colorTo: red
6
- sdk: static
7
- pinned: false
8
- ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+ # Pokémon Red Clone
 
 
 
 
 
 
 
 
 
bundle.js ADDED
The diff for this file is too large to render. See raw diff
 
bundle.js.LICENSE.txt ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author Florian Vazelle
3
+ * @author Geoffrey Glaive
4
+ * @copyright 2020 Photon Storm Ltd.
5
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
6
+ */
7
+
8
+ /**
9
+ * @author Jason Nicholls <nicholls.jason@gmail.com>
10
+ * @copyright 2018 Photon Storm Ltd.
11
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
12
+ */
13
+
14
+ /**
15
+ * @author Joachim Grill <joachim@codeandweb.com>
16
+ * @author Richard Davey <rich@photonstorm.com>
17
+ * @copyright 2018 CodeAndWeb GmbH
18
+ * @copyright 2020 Photon Storm Ltd.
19
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
20
+ */
21
+
22
+ /**
23
+ * @author Niklas von Hertzen (https://github.com/niklasvh/base64-arraybuffer)
24
+ * @author Richard Davey <rich@photonstorm.com>
25
+ * @copyright 2020 Photon Storm Ltd.
26
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
27
+ */
28
+
29
+ /**
30
+ * @author Richard Davey
31
+ * @copyright 2020 Photon Storm Ltd.
32
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
33
+ */
34
+
35
+ /**
36
+ * @author Richard Davey <rich@photonstorm.com>
37
+ * @author @samme
38
+ * @copyright 2020 Photon Storm Ltd.
39
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
40
+ */
41
+
42
+ /**
43
+ * @author Richard Davey <rich@photonstorm.com>
44
+ * @author Angry Bytes (and contributors)
45
+ * @copyright 2020 Photon Storm Ltd.
46
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
47
+ */
48
+
49
+ /**
50
+ * @author Richard Davey <rich@photonstorm.com>
51
+ * @author Benjamin D. Richards <benjamindrichards@gmail.com>
52
+ * @copyright 2020 Photon Storm Ltd.
53
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
54
+ */
55
+
56
+ /**
57
+ * @author Richard Davey <rich@photonstorm.com>
58
+ * @author Felipe Alfonso <@bitnenfer>
59
+ * @author Matthew Groves <@doormat>
60
+ * @copyright 2020 Photon Storm Ltd.
61
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
62
+ */
63
+
64
+ /**
65
+ * @author Richard Davey <rich@photonstorm.com>
66
+ * @author Felipe Alfonso <@bitnenfer>
67
+ * @copyright 2020 Photon Storm Ltd.
68
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
69
+ */
70
+
71
+ /**
72
+ * @author Richard Davey <rich@photonstorm.com>
73
+ * @author Florian Mertens
74
+ * @copyright 2020 Photon Storm Ltd.
75
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
76
+ */
77
+
78
+ /**
79
+ * @author Richard Davey <rich@photonstorm.com>
80
+ * @author Igor Ognichenko <ognichenko.igor@gmail.com>
81
+ * @copyright 2020 Photon Storm Ltd.
82
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
83
+ */
84
+
85
+ /**
86
+ * @author Richard Davey <rich@photonstorm.com>
87
+ * @author Pavle Goloskokovic <pgoloskokovic@gmail.com> (http://prunegames.com)
88
+ * @copyright 2020 Photon Storm Ltd.
89
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
90
+ */
91
+
92
+ /**
93
+ * @author Richard Davey <rich@photonstorm.com>
94
+ * @author samme <samme.npm@gmail.com>
95
+ * @copyright 2020 Photon Storm Ltd.
96
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
97
+ */
98
+
99
+ /**
100
+ * @author Richard Davey <rich@photonstorm.com>
101
+ * @copyright 2020 Photon Storm Ltd.
102
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
103
+ */
104
+
105
+ /**
106
+ * @author Seth Berrier <berriers@uwstout.edu>
107
+ * @copyright 2020 Photon Storm Ltd.
108
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
109
+ */
110
+
111
+ /**
112
+ * @author Stefan Hedman <schteppe@gmail.com> (http://steffe.se)
113
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
114
+ */
115
+
116
+ /**
117
+ * @author Vladimir Agafonkin
118
+ * @author Richard Davey <rich@photonstorm.com>
119
+ * @copyright 2020 Photon Storm Ltd.
120
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
121
+ */
122
+
123
+ /**
124
+ * @author pi-kei
125
+ * @copyright 2020 Photon Storm Ltd.
126
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
127
+ */
128
+
129
+ /**
130
+ * @author samme
131
+ * @copyright 2020 Photon Storm Ltd.
132
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
133
+ */
134
+
135
+ /**
136
+ * @author samme
137
+ * @copyright 2021 Photon Storm Ltd.
138
+ * @license {@link https://opensource.org/licenses/MIT|MIT License}
139
+ */
140
+
141
+ /**
142
+ * @author Richard Davey <rich@photonstorm.com>
143
+ * @copyright 2020 Photon Storm Ltd.
144
+ * @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License}
145
+ */
index.html CHANGED
@@ -1,19 +1,16 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Pokémon Red Clone</title><style>body {
2
+ margin: 0;
3
+ padding: 0;
4
+ background-color: #000;
5
+ display: flex;
6
+ justify-content: center;
7
+ align-items: center;
8
+ height: 100vh;
9
+ overflow: hidden;
10
+ }
11
+ #game-container {
12
+ width: 100%;
13
+ max-width: 800px;
14
+ height: 100%;
15
+ max-height: 600px;
16
+ }</style><script defer="defer" src="bundle.js"></script></head><body><div id="game-container"></div></body></html>