Skip to content

Instantly share code, notes, and snippets.

View Ratstail91's full-sized avatar

Kayne Ruse Ratstail91

View GitHub Profile

API

This api can be tested with curl like this:

curl https://mock.eggtrainer.com/stat/v1/<route>
# Every route is a GET and HEAD route
# Every route is a GET and HEAD route
# All data is returned in JSON format
#########################
# global "last updated" data can be fetched from here
/stat/v1
# potential utility routes
/stat/v1/shop*
@Ratstail91
Ratstail91 / api.txt
Created April 8, 2021 17:53
potential public api for egg trainer
# Every route is a GET and HEAD route
# global "last updated" data can be fetched from here
/stat/v1
# potential utility routes
/stat/v1/shop*
/stat/v1/battle*
# return entire type graph
const info = tasks.map( x => x.infos );
import pool from '../utilities/database';
import { log } from '../utilities/logging';
import { determineSelectedCreature, getYourCreatures } from '../reusable';
import speciesIndex from '../gameplay/species.json';
export const apiYourCreaturesBreed = (req, res) => {
//handle all outcomes
//contents based on the type of the tile
public enum DungeonContent {
EMPTY = 0, STAIRS_UP, STAIRS_DOWN, SPAWN_MONSTER, SPAWN_TREASURE
};
import React, { useEffect, useState } from "react";
import "./styles.css";
export default function App() {
const [log, setLog] = useState([]);
const [payments, setPayments] = useState([]); //react elements
//utility functions
function pushToLog(amount, diff) {
log.push({amount: amount, diff: diff });
@Ratstail91
Ratstail91 / DungeonGenerator.cs
Last active November 21, 2020 13:09
Incomplete dungeon generator - only implements binary space partitioning right now.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DungeonGenerator : MonoBehaviour {
//parameters
public int dungeonWidth = 100;
public int dungeonHeight = 100;
public int terminationThreshold = 10;

Rules

The goal of this card game is to explore a dungeon with your team of four adventurers. You are scored based on how much gold you gather before you can escape the dungoen. Each adventurer has 4 points of health; if an adventurer drops to 0 health, they die and are removed from the game; any gold they are carrying is also lost. The order of the characters is important, from left to right. Characters are also either on the front row or the back row. You can re-arrange the order and row of the active characters between events. If all characters are on the same row, it is the front row.

Cards have two halves, the top and bottom. The top half of a card represents an event that is happening (and sometimes a complication), while the bottom half has the actions that the player can take in reaction to the current event.

Each turn:

  • Begin each turn by shuffling the deck, then drawing one card; this is the event card. The event card remains in play until it says it is discarded.
  • Next, draw 5 cards; this i
const pick = odds => {
const total = odds.reduce((a, b) => a + b); //total cards
const index = Math.random() * total; //card to choose
//NOTE: NOT using Math.floor(), as 'odds' can contain fractional values
//find the rarity slot that index falls into
let slot;
let running = index; //the running total, counting backwards
for (let i = 0; i < total; i++) {