Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Copyright (c) 2017 candyapplecorn
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
- // Let's call this suggested item "Level Masker".
- // By adding this code to the PLAYER entity and the
- // logic responsible for generating enemies, we can
- // achieve a lure-like effect.
- // Of course Mackan would have to add a new item to the
- // #!items shop and give it a cost, his discretion the price
- // when a player uses "Level Masker":
- class player{
- constructor(){
- this.mask = {
- maxLimit: 5, // ARBITRARY. Could add a game mechanic to increase this as well!
- used: 0,
- level = null,
- timeout: null
- }
- this.level = API_CALL_RETRIEVE_PLAYER_INFO_FROM_DATABASE()
- // the player already has a level, idc how it's obtained
- //... idk what else code you have
- }
- // ...
- maskLevel(){
- // Error check: is the player attempting to exceed the maximum # of
- // "Level Masker" items he/she may?
- if (this.mask.used >= this.mask.maxLimit)
- return "You're all tweaked out on Level Masker, " +
- "it would be a bad dangerous to use more."
- // 1: increment the masksUsed counter, which
- // is used for calculating power of generated enemy
- this.mask.used++
- // 1.5: calculate the player's fake, "masked" level
- // 1 "Level Masker" used? player's masked/fake level is 25
- // 2 "Level Masker" used? player's level is 25% higher
- // 3 used? 50% higher, 4 used? 75% higher, 5 used? 100% higher
- switch (this.mask.used){
- case 1:
- this.mask.level = 25;
- break;
- default:
- this.mask.level = (this.mask.used - 1) * 0.25 * this.level;
- }
- // 2: clear the player's timeout if it exists
- if (this.mask.timeout)
- clearTimeout(this.mask.timeout)
- // 3: Set a timeout that will reset used to 0 in an hour.
- this.mask.timeout = setTimeout(() => { this.mask.used = 0 }, 1000 * 60 * 60)
- }
- // snippet - Mackan I don't have your source code anyways
- }
- // In the code that spawns an enemy for the player to fight:
- // There's some code that calculates the max level for an enemy
- // IDK what the code is BUTTTT......
- function generateEnemy(player){
- var maximumEnemyLevel,
- minimumEnemyLevel = player.level
- if (player.mask.used == 0)
- CALCULATE_ENEMY_NORMALLY_AS_BEFORE_THIS_SUGGESTION(),
- maximumEnemyLevel = player.level // I think this is how it works right??
- else
- maximumEnemyLevel = player.mask.level,
- minimumEnemyLevel = player.mask.level / 2 /* AGAIN, is ARBITRARY */
- // proceed as normal
- }
Advertisement
Add Comment
Please, Sign In to add comment