Skip to content

Commit

Permalink
#71 #55 Defense buff, defense indicator text
Browse files Browse the repository at this point in the history
[updatedDoc]
  • Loading branch information
64bitpandas committed Mar 25, 2019
1 parent 7377e43 commit 1e37c0b
Show file tree
Hide file tree
Showing 32 changed files with 39,237 additions and 34,188 deletions.
5,500 changes: 2,830 additions & 2,670 deletions docs/ast/source/client/js/global.js.json

Large diffs are not rendered by default.

556 changes: 278 additions & 278 deletions docs/ast/source/client/js/obj/blueprints.js.json

Large diffs are not rendered by default.

22,562 changes: 12,814 additions & 9,748 deletions docs/ast/source/client/js/obj/player.js.json

Large diffs are not rendered by default.

9,196 changes: 4,598 additions & 4,598 deletions docs/ast/source/client/js/socket.js.json

Large diffs are not rendered by default.

11,662 changes: 5,831 additions & 5,831 deletions docs/ast/source/server/server.js.json

Large diffs are not rendered by default.

1,998 changes: 1,126 additions & 872 deletions docs/ast/source/server/utils/compound.js.json

Large diffs are not rendered by default.

21,295 changes: 11,341 additions & 9,954 deletions docs/ast/source/server/utils/ondamage.js.json

Large diffs are not rendered by default.

376 changes: 268 additions & 108 deletions docs/ast/source/server/utils/serverinit.js.json

Large diffs are not rendered by default.

70 changes: 35 additions & 35 deletions docs/class/src/client/js/obj/player.js~Player.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ <h1 data-ice="name">Player</h1>



<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-hasShield">hasShield</a></span></span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span></span>
<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-health">health</a></span></span><span class="code" data-ice="signature">: <span>*</span></span>
</p>
</div>
<div>
Expand Down Expand Up @@ -287,7 +287,7 @@ <h1 data-ice="name">Player</h1>



<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-health">health</a></span></span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-height">height</a></span></span><span class="code" data-ice="signature">: <span>*</span></span>
</p>
</div>
<div>
Expand Down Expand Up @@ -315,7 +315,7 @@ <h1 data-ice="name">Player</h1>



<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-height">height</a></span></span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-isMoving">isMoving</a></span></span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span></span>
</p>
</div>
<div>
Expand Down Expand Up @@ -343,7 +343,7 @@ <h1 data-ice="name">Player</h1>



<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-isMoving">isMoving</a></span></span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span></span>
<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-name">name</a></span></span><span class="code" data-ice="signature">: <span>*</span></span>
</p>
</div>
<div>
Expand Down Expand Up @@ -371,7 +371,7 @@ <h1 data-ice="name">Player</h1>



<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-name">name</a></span></span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-playerSprite">playerSprite</a></span></span><span class="code" data-ice="signature">: <span>*</span></span>
</p>
</div>
<div>
Expand Down Expand Up @@ -399,7 +399,7 @@ <h1 data-ice="name">Player</h1>



<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-playerSprite">playerSprite</a></span></span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-room">room</a></span></span><span class="code" data-ice="signature">: <span>*</span></span>
</p>
</div>
<div>
Expand Down Expand Up @@ -427,7 +427,7 @@ <h1 data-ice="name">Player</h1>



<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-room">room</a></span></span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-member-shield">shield</a></span></span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></span>
</p>
</div>
<div>
Expand Down Expand Up @@ -658,7 +658,7 @@ <h1 data-ice="name">Player</h1>



<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-method-changeSprite">changeSprite</a></span></span><span class="code" data-ice="signature">(hasShield: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span>, stronghold: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>)</span>
<span class="code" data-ice="name"><span><a href="class/src/client/js/obj/player.js~Player.html#instance-method-changeSprite">changeSprite</a></span></span><span class="code" data-ice="signature">(shield: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, stronghold: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>)</span>
</p>
</div>
<div>
Expand Down Expand Up @@ -1421,18 +1421,18 @@ <h3 data-ice="anchor" id="instance-member-experience">

</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-member-hasShield">
<h3 data-ice="anchor" id="instance-member-health">
<span class="access" data-ice="access">public</span>





<span class="code" data-ice="name">hasShield</span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span></span>
<span class="code" data-ice="name">health</span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="right-info">


<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber49">source</a></span></span>
<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber45">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -1464,18 +1464,18 @@ <h3 data-ice="anchor" id="instance-member-hasShield">

</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-member-health">
<h3 data-ice="anchor" id="instance-member-height">
<span class="access" data-ice="access">public</span>





<span class="code" data-ice="name">health</span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="code" data-ice="name">height</span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="right-info">


<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber45">source</a></span></span>
<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber30">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -1507,18 +1507,18 @@ <h3 data-ice="anchor" id="instance-member-health">

</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-member-height">
<h3 data-ice="anchor" id="instance-member-isMoving">
<span class="access" data-ice="access">public</span>





<span class="code" data-ice="name">height</span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="code" data-ice="name">isMoving</span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span></span>
<span class="right-info">


<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber30">source</a></span></span>
<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber46">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -1550,18 +1550,18 @@ <h3 data-ice="anchor" id="instance-member-height">

</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-member-isMoving">
<h3 data-ice="anchor" id="instance-member-name">
<span class="access" data-ice="access">public</span>





<span class="code" data-ice="name">isMoving</span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span></span>
<span class="code" data-ice="name">name</span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="right-info">


<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber46">source</a></span></span>
<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber42">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -1593,18 +1593,18 @@ <h3 data-ice="anchor" id="instance-member-isMoving">

</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-member-name">
<h3 data-ice="anchor" id="instance-member-playerSprite">
<span class="access" data-ice="access">public</span>





<span class="code" data-ice="name">name</span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="code" data-ice="name">playerSprite</span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="right-info">


<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber42">source</a></span></span>
<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber54">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -1636,18 +1636,18 @@ <h3 data-ice="anchor" id="instance-member-name">

</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-member-playerSprite">
<h3 data-ice="anchor" id="instance-member-room">
<span class="access" data-ice="access">public</span>





<span class="code" data-ice="name">playerSprite</span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="code" data-ice="name">room</span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="right-info">


<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber54">source</a></span></span>
<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber43">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -1679,18 +1679,18 @@ <h3 data-ice="anchor" id="instance-member-playerSprite">

</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-member-room">
<h3 data-ice="anchor" id="instance-member-shield">
<span class="access" data-ice="access">public</span>





<span class="code" data-ice="name">room</span><span class="code" data-ice="signature">: <span>*</span></span>
<span class="code" data-ice="name">shield</span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></span>
<span class="right-info">


<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber43">source</a></span></span>
<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber49">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -2033,11 +2033,11 @@ <h3 data-ice="anchor" id="instance-method-changeSprite">



<span class="code" data-ice="name">changeSprite</span><span class="code" data-ice="signature">(hasShield: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span>, stronghold: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>)</span>
<span class="code" data-ice="name">changeSprite</span><span class="code" data-ice="signature">(shield: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, stronghold: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>)</span>
<span class="right-info">


<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber123">source</a></span></span>
<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber127">source</a></span></span>
</span>
</h3>

Expand All @@ -2058,10 +2058,10 @@ <h4 data-ice="title">Params:</h4>
<tbody>

<tr data-ice="property" data-depth="0">
<td data-ice="name" class="code" data-depth="0">hasShield</td>
<td data-ice="type" class="code"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span></td>
<td data-ice="name" class="code" data-depth="0">shield</td>
<td data-ice="type" class="code"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td>
<td data-ice="appendix"></td>
<td data-ice="description"><p>True if the player has shield from an element</p>
<td data-ice="description"><p>Number of extra defense points from buffs, elements, etc.</p>
</td>
</tr>
<tr data-ice="property" data-depth="0">
Expand Down Expand Up @@ -2149,7 +2149,7 @@ <h3 data-ice="anchor" id="instance-method-tick">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber101">source</a></span></span>
<span data-ice="source"><span><a href="file/src/client/js/obj/player.js.html#lineNumber104">source</a></span></span>
</span>
</h3>

Expand Down
4 changes: 2 additions & 2 deletions docs/coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"actualCount": 3,
"undocumentLines": [
4,
175
176
]
},
"src/client/js/lib/chat-client.js": {
Expand Down Expand Up @@ -210,7 +210,7 @@
"expectCount": 3,
"actualCount": 2,
"undocumentLines": [
139
144
]
},
"src/server/utils/serverinit.js": {
Expand Down
1 change: 1 addition & 0 deletions docs/file/src/client/js/global.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
MAX_STRONGHOLD_HEALTH: 200,
MAX_NUCLEUS_HEALTH: 300,
STRONGHOLD_RADIUS: 100,
STRONGHOLD_DEFENSE: 5,

// Drawing
DRAW_RADIUS: 1000, // Radius around player in which to draw other objects
Expand Down
2 changes: 1 addition & 1 deletion docs/file/src/client/js/obj/blueprints.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
texture: &apos;compound_ozone.png&apos;,
type: &apos;defense&apos;,
params: {
defenseModifier: 10
defenseModifier: 1
},
atoms: {
o: 3
Expand Down
14 changes: 9 additions & 5 deletions docs/file/src/client/js/obj/player.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
this.isMoving = false
this.experience = experience // Sets the experience of the player(Passed in)
this.speedMult = 1 // Speed multiplier. Increased/decreased by different compounds
this.hasShield = false
this.shield = 0
this.stronghold = &apos;none&apos;

this.damagedBy = {} // Object containing the values of damage that each player has dealt.
Expand All @@ -177,6 +177,7 @@
this.textObjects.postext = new PIXI.Text(&apos;placeholderpos&apos;)
this.textObjects.teamtext = new PIXI.Text(&apos;team: &apos;)
this.textObjects.healthtext = new PIXI.Text(&apos;health: &apos;)
this.textObjects.defensetext = new PIXI.Text(&apos;defense: &apos;)

// Assign values and positions
this.textObjects.idtext.position.set(0, GLOBAL.PLAYER_RADIUS * 9)
Expand All @@ -186,6 +187,8 @@
this.textObjects.postext.position.set(0, GLOBAL.PLAYER_RADIUS * 9 + 200)
this.textObjects.teamtext.text += this.team
this.textObjects.teamtext.position.set(0, GLOBAL.PLAYER_RADIUS * 9 + 300)
this.textObjects.defensetext.text += this.shield
this.textObjects.defensetext.position.set(0, GLOBAL.PLAYER_RADIUS * 9 + 400)

// create text and assign color
for (let item in this.textObjects) {
Expand Down Expand Up @@ -216,6 +219,7 @@
// Update text
this.textObjects.postext.text = &apos;(&apos; + Math.round(this.posX) + &apos;, &apos; + Math.round(this.posY) + &apos;)&apos;
this.textObjects.healthtext.text = &apos;health: &apos; + this.health
this.textObjects.defensetext.text = &apos;defense: &apos; + this.shield + ((this.stronghold === &apos;team&apos;) ? &apos; (+5)&apos; : &apos;&apos;)

// Rotation
this.playerSprite.rotation += (this.id === socket.id &amp;&amp; mouseDown) ? GLOBAL.PLAYER_EXPEDITED_ROTATION : GLOBAL.PLAYER_ROTATION
Expand All @@ -228,16 +232,16 @@

/**
* Notifies the player to check for a sprite change (shield, etc).
* @param {boolean} hasShield True if the player has shield from an element
* @param {number} shield Number of extra defense points from buffs, elements, etc.
* @param {string} stronghold &apos;team&apos; if player is in team stronghold, &apos;notteam&apos; if player is in enemy stronghold, &apos;none&apos;, if not in a stronghold
*/
changeSprite(hasShield, stronghold) {
changeSprite(shield, stronghold) {
// Set values
this.hasShield = hasShield
this.shield = shield
this.stronghold = stronghold

// Set sprite
if (this.hasShield || this.stronghold === &apos;team&apos;) {
if (this.shield &gt; 0 || this.stronghold === &apos;team&apos;) {
this.playerSprite.texture = spritesheet.textures[teamColors[this.team] + &apos;playershield.png&apos;]
}
else {
Expand Down
6 changes: 3 additions & 3 deletions docs/file/src/client/js/socket.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@
objects[objType][obj].atomList = objRef.atomList
objects[objType][obj].speedMult = objRef.speedMult

if (objects[objType][obj].hasShield !== objRef.hasShield || objects[objType][obj].stronghold !== objRef.stronghold) {
objects[objType][obj].changeSprite(objRef.hasShield, objRef.stronghold)
if (objects[objType][obj].shield !== objRef.shield || objects[objType][obj].stronghold !== objRef.stronghold) {
objects[objType][obj].changeSprite(objRef.shield, objRef.stronghold)
console.log(&apos;change tex&apos;)
}

objects[objType][obj].hasShield = objRef.hasShield
objects[objType][obj].shield = objRef.shield
objects[objType][obj].stronghold = objRef.stronghold

for (let atom in objRef.atomList) {
Expand Down
2 changes: 1 addition & 1 deletion docs/file/src/server/server.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
// name: &apos;teamname&apos;,
// players: [&apos;id1&apos;, &apos;id2&apos;...]
// ],
// players: { id, name, room, team, health, posX, posY, vx, vy, dead, experience, damagedBy, stronghold },
// players: { id, name, room, team, health, posX, posY, vx, vy, dead, experience, damagedBy, stronghold, defense },
// atoms: { typeID, id, posX, posY, vx, vy, team },
// compounds: { id, posX, posY, vx, vy, blueprint, sendingTeam, sender },
// tiles: { id, type, globalX, globalY, captured, owner, health }
Expand Down
2 changes: 1 addition & 1 deletion docs/file/src/server/utils/compound.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
}
}
else if (data.blueprint.type === &apos;defense&apos;) {
setField(true, [&apos;rooms&apos;, room, &apos;players&apos;, thisPlayer.id, &apos;hasShield&apos;])
setField(data.blueprint.params.defenseModifier, [&apos;rooms&apos;, room, &apos;players&apos;, thisPlayer.id, &apos;shield&apos;])
}
else if (data.blueprint.type === &apos;block&apos;) {
newCompound.vx = newCompound.vy = 0
Expand Down
Loading

0 comments on commit 1e37c0b

Please sign in to comment.