Skip to content

Instantly share code, notes, and snippets.

Avatar

Kayne Ruse Ratstail91

View GitHub Profile
View your_creatures_breed.ts
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
View DungeonContent.cs
//contents based on the type of the tile
public enum DungeonContent {
EMPTY = 0, STAIRS_UP, STAIRS_DOWN, SPAWN_MONSTER, SPAWN_TREASURE
};
View app.jsx
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 Nov 21, 2020
Incomplete dungeon generator - only implements binary space partitioning right now.
View DungeonGenerator.cs
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;
View Card Dungeon.md

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
View martintale.js
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++) {
View dice-dungeons.md

Dice Dungeons

The goal of the game is to defeat monsters, collect gold and escape the dungeon again to level up your avatar. Different avatars can have different effects on the game.

You have a set of 6-sided dice, levels 1-4 (4 each), each of which has a unique set of "crests" (symbols) on their sides. You also have a game board which is 13 square wide, and 19 squares deep. Finally, you have a set of eleven "nets", which are the unique unfolded forms of cubes which can be placed on the game board, see below. Nets have a "summon" point on them.

Gameplay

The game turn begins by rolling four dice of the same level (you can't roll the same level as the previous turn), and recording the number of each crest that was rolled (crests accumulate over turns, but you can only store up to 10 of each crest). If you roll two of the summon crest, then you place a net of your choice on the battlefield touching an existing net (or the starting square), and a monster of that dice level on that net's summon point, fa

View pokemon.js
const fetch = require('node-fetch');
const fs = require('fs');
const nameExceptions = ['ho-oh', 'porygon-z', 'jangmo-o', 'hakamo-o', 'kommo-o', 'mr-mime', 'mime-jr', 'type-null', 'tapu-lele', 'tapu-fini', 'tapu-koko', 'tapu-bulu'];
const collection = {};
(async () => {
const result = fetch('https://pokeapi.co/api/v2/pokemon?limit=100000')
.then(res => res.text())
.then(blob => JSON.parse(blob).results)
View AudioManager.cs
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AudioManager : MonoBehaviour {
//singleton
static AudioManager instance = null;
//internals